# Random time with range

**URL:** <https://forum.kirupa.com/t/random-time-with-range/224951>\
**Category:** flash\
**Created:** [May 7, 2007, 2:49pm UTC](https://forum.kirupa.com/t/random-time-with-range/224951 "2007-05-07T14:49:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![reblis](https://avatars.discourse-cdn.com/v4/letter/r/b19c9b/32.png) [@reblis](https://forum.kirupa.com/u/reblis)\
**Post date:** [May 7, 2007, 2:49pm UTC](https://forum.kirupa.com/t/random-time-with-range/224951/1 "2007-05-07T14:49:39Z")

</div>

This is the code I have for a MC which will be one of many on the stage.

onClipEvent (enterFrame) {  
function randRange(min:Number, max:Number):Number {  
var randomNum:Number = Math.floor(Math.random()\*(max-min+1))+min;  
return randomNum;  
}  
\_alpha = randRange(0, 60);  
}

It randomizes the alpha which is what I want with a range that I can change. I just need to know how to randomize the time with a range. ( 2-6 seconds )

Is there anyone that can help with this?

~reblis
