public class NotRandom extends Random
Random that may be useful
for testing random algorithms that accept an instance of Random
as a parameter. This algorithm maintains internal counters which are
incremented after each call, and returns values which are functions of
those counter values. Thus the output is not only deterministic (as is
necessarily true of all software with no externalities) but precisely
predictable in distribution.| Constructor and Description |
|---|
NotRandom(int size)
Creates an instance with the specified sample size.
|
| Modifier and Type | Method and Description |
|---|---|
double |
nextDouble()
Returns the post-incremented value of the internal counter modulo
size, divided by size. |
float |
nextFloat()
Returns the post-incremented value of the internal counter modulo
size, divided by size. |
int |
nextInt(int n)
Returns the post-incremented value of the internal counter modulo n.
|
public NotRandom(int size)
size - the sample sizepublic int nextInt(int n)
public double nextDouble()
size, divided by size.nextDouble in class RandomCopyright © 2016. All rights reserved.