randRange Function

I find myself needing a random number between 2 numbers often. So I wrote this awhile ago and then go trotting back through code to find it. I thought it would be better if I just posted it here for quicker access

function randRange(minNum:Number, maxNum:Number):Number {
	return (Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum);
}
 
trace(randRange(1, 100));


You must be logged in to post a comment.