# Random Image Loading

**URL:** <https://forum.kirupa.com/t/random-image-loading/59452>\
**Category:** flash\
**Created:** [July 31, 2004, 6:20pm UTC](https://forum.kirupa.com/t/random-image-loading/59452 "2004-07-31T18:20:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SniperFire](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@SniperFire](https://forum.kirupa.com/u/SniperFire)\
**Post date:** [July 31, 2004, 6:20pm UTC](https://forum.kirupa.com/t/random-image-loading/59452/1 "2004-07-31T18:20:53Z")

</div>

I’ve want to display 2 random images on the same page from a directory that has 5 images in it.

I got the random part, but I can’t get the pics to load simultaneously. Can someone point out what I did wrong?

```auto

Array.prototype.pickRandomValues = function(n) {
	var selected = [];
	for (var i = 0; i<n; ++i) {
		var r = Math.floor(Math.random()*this.length);
		selected.push(this[r]);
		this.splice(r, 1);
	}
	return selected;
};
loadMovie("img/"+pictures_array.pickRandomValues(1)+".jpg", "container_mc");
loadMovie("img/"+pictures_array.pickRandomValues(1)+".jpg", "container_mc copy");

```
