# URGENT: Need help randomizing

**URL:** <https://forum.kirupa.com/t/urgent-need-help-randomizing/242327>\
**Category:** flash\
**Created:** [October 24, 2007, 7:55pm UTC](https://forum.kirupa.com/t/urgent-need-help-randomizing/242327 "2007-10-24T19:55:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![visualmonk](https://avatars.discourse-cdn.com/v4/letter/v/e495f1/32.png) [@visualmonk](https://forum.kirupa.com/u/visualmonk)\
**Post date:** [October 24, 2007, 7:55pm UTC](https://forum.kirupa.com/t/urgent-need-help-randomizing/242327/1 "2007-10-24T19:55:56Z")

</div>

Hey guys,

I have this for loop that gradually scales in masks over a series of images and im trying to figure out how to randomly scale in the masks instead of based on their instance name. I know theres a way to do it using Math.random but have no idea how…

//function starts tiles animations  
function tiles\_start(clipName) {  
clipName = eval(clipName);  
clipName.copyName.alphaTo(100,.5,“linear”);  
// loop animates masks based on instance name  
for (i=1; i\<28; i++) {  
if (i\<=5) {  
clipName.collage[“clip”+i].scaleTo(100,2,“easeOutExpo”);  
} else if (i\>=5) {  
clipName.collage[“clip”+i].scaleTo(100,4,“easeOutExpo”);  
} else if (i\>=10) {  
clipName.collage[“clip”+i].scaleTo(100,6,“easeOutExpo”);  
} else if (i\>=15) {  
clipName.collage[“clip”+i].scaleTo(100,8,“easeOutExpo”);  
} else if (i\>=20) {  
clipName.collage[“clip”+i].scaleTo(100,10,“easeOutExpo”);  
}  
}  
}

//function returns masks to original state and sets copy to zero  
function tiles\_return(clipName) {  
clipName = eval(clipName);  
clipName.copyName.alphaTo(0,1,“linear”);  
for (i=1; i\<28; i++) {  
if (i\<=28) {  
clipName.collage[“clip”+i].scaleTo(0,1,“easeOutExpo”);  
}  
}  
}

Thanks!
