Return to Snippet

Revision: 28364
at July 7, 2010 07:37 by IsoJon


Initial Code
// usage
trace( randRange( 1, 10 ));


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

Initial URL


Initial Description
Always need one of these on hand. Feed it a minimum number and a maximum number and it returns a random within that range. Super useful.

Initial Title
Find Random Number in Range

Initial Tags
number

Initial Language
ActionScript 3