JSFiddle - React, Tailwind, and code Playground

HTML

<img id='random'/>

JavaScript

var img = new Array ();
img[0] = "http://placehold.it/20";
img[1] = "http://placehold.it/30";
img[2] = "http://placehold.it/40";
img[3] = "http://placehold.it/50";
var size = img.length
var x = Math.floor(size*Math.random())

$('#random').attr('src',img[x]);