# Random Picture Loading

**URL:** <https://forum.kirupa.com/t/random-picture-loading/59451>\
**Category:** flash\
**Created:** [July 31, 2004, 6:11pm UTC](https://forum.kirupa.com/t/random-picture-loading/59451 "2004-07-31T18:11:31Z")\
**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:11pm UTC](https://forum.kirupa.com/t/random-picture-loading/59451/1 "2004-07-31T18:11:31Z")

</div>

Hi All,

Got a slight problem and I’m pulling my hair out…

I have a page that shows 2 random pictures pulled from a image directory that has 5 images.

I got the random bit from somewhere but can’t get the pictures to load simultaneously. Can someone tell me where I’m going wrong?

```auto

pictures_array = [1, 2, 3, 4, 5];
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");

```
