Package io.jawk.jrt
Class BSDRandom
java.lang.Object
io.jawk.jrt.BSDRandom
Simple pseudo-random number generator compatible with the C library
random() function.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturn the next pseudo-random number in the range[0.0,1.0).final voidsetSeed(int seed) Seed the generator.
-
Constructor Details
-
BSDRandom
public BSDRandom(int seed) Creates a new generator with the specified seed.- Parameters:
seed- Initial pseudo-random seed
-
-
Method Details
-
setSeed
public final void setSeed(int seed) Seed the generator. A seed of0is transformed to1as in the original implementation.- Parameters:
seed- New pseudo-random seed
-
nextDouble
public double nextDouble()Return the next pseudo-random number in the range[0.0,1.0).- Returns:
- Next pseudo-random floating-point value
-