Random Range
snipped by d_wright66
The randRange function returns a random number between the two numbers passed to it.
The function randRange in the code below will return a number a random between the numbers passed to it. This function even works with negative numbers. The first number should be the minimum and the second number should be the maximum. In the example below dice will contain a random number between 1 and 6.
dice = randRange(1,6); function randRange(min, max) { randomNum = Math.round(Math.random() * (max-min+1) + (min-.5)); return randomNum; }




