java.lang.Objectobjectdraw.RandomIntGenerator
public class RandomIntGenerator
A RandomIntGenerator
will produce a string of random int
s that
are in the range it was created to produce. Each number x will satisfy
min <= x <= max
, and the numbers will be distributed evenly and unpredictably
within that range.
You can think of the generator as being like a set of dice, which I can roll over and over
again (with nextValue()
) to get different results each time. So, if I construct
a new RandomIntGenerator(1, 10)
it might produce 3, then 7, then 5, and so on.
Constructor Summary | |
---|---|
RandomIntGenerator(int min,
int max)
Construct a random number generator that will deliver int s in the given
range. |
Method Summary | |
---|---|
int |
nextValue()
Return another random number |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RandomIntGenerator(int min, int max)
int
s in the given
range.
min
- Minimum value that may be producedmax
- Maximum value that may be producedMethod Detail |
---|
public int nextValue()