posted 16 years ago
Basically, the idea is to transform the output of the given methods. In general, multiply by some factor to transform the range, and then add/subtract to shift that range.
For example, nextDouble returns a value between 0.0 and 1.0. So if you wanted a value between -2 and 3, you could use...
double myDouble = (Random.nextDouble() * 5) - 2;
[ April 23, 2007: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org