|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--BallBox
This class implements a random number generator where the numbers in the sequence are guaranteed to be unique.
| Constructor Summary | |
BallBox()
Creates a ballbox that will return any legal positive integer. |
|
BallBox(int max)
Creates a ballbox that will return numbers in the sequence 0..max-1. |
|
BallBox(int max,
long seed)
Creates a seeded ballbox that will return numbers in the sequence 0..max-1. |
|
BallBox(long seed)
Creates a seeded ballbox that will return any legal positive integer. |
|
| Method Summary | |
boolean |
moreBalls()
Returns true if there are unused numbers in the sequence. |
int |
nextBall()
Returns the next number in the sequence. |
void |
refill()
Reset the sequence. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public BallBox(int max)
max - the maximum number returned.
public BallBox(int max,
long seed)
max - the maximum number returned.seed - seed for the random number generator.public BallBox()
public BallBox(long seed)
seed - the seed for the random number generator.| Method Detail |
public int nextBall()
public void refill()
public boolean moreBalls()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||