# Unique random images from library

**URL:** https://forum.kirupa.com/t/unique-random-images-from-library/164091
**Category:** flash
**Created:** [September 28, 2005, 2:41pm UTC](https://forum.kirupa.com/t/unique-random-images-from-library/164091 "2005-09-28T14:41:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ukko](https://avatars.discourse-cdn.com/v4/letter/u/e68b1a/32.png) [@ukko](https://forum.kirupa.com/u/ukko)
#### Post date: [September 28, 2005, 2:41pm UTC](https://forum.kirupa.com/t/unique-random-images-from-library/164091/1 "2005-09-28T14:41:13Z")

</div>

:hr:  
i am displaying random pictures in a movie. each time the  
user put the mcs into a cages a new movieclip will appears and that mc will be removed from array.  
my problem is that at the moment 2 or more of the same movieclip  
can appear on the screen again, once they have been entered into the cages.

how can I resolve this?

thanks kirupa members

code so far

23 images in the array.

picArray = new Array(“image1”, “image7”, “image8”, “image13”, “image15”, “image10”, “image20”, “image18”, “image17”, “image23”, “image22”, “image9”, “image3”, “image19”, “image21”, “image6”, “image24”, “image5”, “image12”, “image2”, “image25”, “image11”, “image14”);

for (i = 0 ; i \<= picArray.length ; i++)  
{  
rdmNum = Math.floor(Math.random() \* picArray.length);  
this.blank.attachMovie(this.picArray[rdmNum], pic1, 0);  
trace(i + " : " + rdmNum + " : " + picArray[rdmNum] + " ; " + picArray);  
i = 0;  
picArray.splice(rdmNum, 1);  
}
