org.jgap.util
Class randomLEcuyer
- java.lang.Object
-
- org.jgap.util.randomX
-
- org.jgap.util.randomLEcuyer
-
public class randomLEcuyer extends randomX
Implementation of a randomX-compliant class using L'Ecuyer's two-sequence generator with a Bays-Durham shuffle, as described on page 282 of Press et al., Numerical Recipes in C, 2nd edition. Their implementation was constrained by the absence of a 64-bit integer data type. Since Java guarantees a long to be 64 bit, we can use L'Ecuyer's multiplier and modulus directly, rather than flailing around with Schrage's algorithm. Further, 64-bit long arithmetic allows us to directly combine the results from the two generators by adding and taking the modulus of one of them, bypassing the subtract and test for negative gimmick used in Numerical Recipes.For additional details, see L'Ecuyer's original 1968 paper at page 742 of Communications of the ACM, Vol. 31.
Designed and implemented in July 1996 by John Walker, kelvin@fourmilab.ch.
-
-
Constructor Summary
Constructors Constructor and Description randomLEcuyer()Creates a new pseudorandom number generator, seeded from the current time.randomLEcuyer(long seed)Creates a new pseudorandom number generator with a specified nonzero seed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description bytenextByte()Get next byte from generator.voidsetSeed(long seed)Set seed for generator.
-
-
-
Constructor Detail
-
randomLEcuyer
public randomLEcuyer()
Creates a new pseudorandom number generator, seeded from the current time.
-
randomLEcuyer
public randomLEcuyer(long seed) throws java.lang.IllegalArgumentExceptionCreates a new pseudorandom number generator with a specified nonzero seed.- Parameters:
seed- initial seed for the generator- Throws:
java.lang.IllegalArgumentException
-
-
DMelt 3.0 © DataMelt by jWork.ORG