var images = ["https://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Playing_card_heart_5.svg/200px-Playing_card_heart_5.svg.png", "http://www.pandasecurity.com/mediacenter/src/uploads/2014/11/short-link.jpg", ];
function myFunction() {
var x = Math.floor((Math.random() * images.length); $('#afbeelding').attr('src', images[x]);
}
HTML:
<button onclick="myFunction()">Try it</button>
<img id="afbeelding">