Hello, you have a couple of routes. One, just generate a random number in the range you need to begin with.

Remember, Math.random() generates a number in the this range: [0, 1). That's zero-inclusive to 1-exclusive. So, just multiply that generated number by whatever limit you want to specify a range of [0, someLimit) and then add one to your result to get the range of [1, someLimit] - that's 1-inclusive to someLimit-inclusive.

If you really wanted the method to pick random numbers from 0 to 99 and then only use a value when the number is between 1 and 45, you could define a method to generate a number. The method would use recursion to be certain the number is within the proper range. Something like:

Good Luck,

-Dirk Schreckmann

P.S. This initial response was generated in haste, don't take it as bug-proof yet. When I have time later I'll check it, or someone might correct any mistakes (if they exist) before then.

[ February 09, 2002: Message edited by: Dirk Schreckmann ]