# How to randomise selection from library?

**URL:** <https://forum.kirupa.com/t/how-to-randomise-selection-from-library/274445>\
**Category:** flash\
**Created:** [October 30, 2008, 2:17am UTC](https://forum.kirupa.com/t/how-to-randomise-selection-from-library/274445 "2008-10-30T02:17:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![charli2](https://avatars.discourse-cdn.com/v4/letter/c/b9e5f3/32.png) [@charli2](https://forum.kirupa.com/u/charli2)\
**Post date:** [October 30, 2008, 2:17am UTC](https://forum.kirupa.com/t/how-to-randomise-selection-from-library/274445/1 "2008-10-30T02:17:05Z")

</div>

could anyone tell me how to make the following peice of code select randomly from various movieclips in the library, rather than using just one movieclip?

depth = 0;  
function makeNewClip(){  
newClip = \_root.attachMovie(‘drop6’, ‘drop6’+depth, depth++);  
newClip.\_x = Math.random()\*Stage.width;  
newClip.\_y = -50;  
newClip.speed = (Math.random()\*10);  
newClip.onEnterFrame = function() {  
this.\_y+= this.speed;  
};  
}  
makeNewClip();  
setInterval(makeNewClip, 2000);

:insomniac:
