edu.uci.ics.jung.algorithms.util
Class NotRandom
- java.lang.Object
-
- java.util.Random
-
- edu.uci.ics.jung.algorithms.util.NotRandom
-
- All Implemented Interfaces:
- java.io.Serializable
public class NotRandom extends java.util.RandomA decidedly non-random extension ofRandomthat may be useful for testing random algorithms that accept an instance ofRandomas 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.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description NotRandom(int size)Creates an instance with the specified sample size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublenextDouble()Returns the post-incremented value of the internal counter modulosize, divided bysize.floatnextFloat()Returns the post-incremented value of the internal counter modulosize, divided bysize.intnextInt(int n)Returns the post-incremented value of the internal counter modulo n.
-
-
-
Constructor Detail
-
NotRandom
public NotRandom(int size)
Creates an instance with the specified sample size.- Parameters:
size- the sample size
-
-
Method Detail
-
nextInt
public int nextInt(int n)
Returns the post-incremented value of the internal counter modulo n.- Overrides:
nextIntin classjava.util.Random
-
nextDouble
public double nextDouble()
Returns the post-incremented value of the internal counter modulosize, divided bysize.- Overrides:
nextDoublein classjava.util.Random
-
nextFloat
public float nextFloat()
Returns the post-incremented value of the internal counter modulosize, divided bysize.- Overrides:
nextFloatin classjava.util.Random
-
-
DataMelt 3.0 © DataMelt by jWork.ORG