cern.jet.random.tdouble.engine
Class DRand
- java.lang.Object
-
- cern.colt.PersistentObject
-
- cern.jet.random.tdouble.engine.DoubleRandomEngine
-
- cern.jet.random.tdouble.engine.DRand
-
- All Implemented Interfaces:
- DoubleFunction, IntFunction, LongFunction, java.io.Serializable, java.lang.Cloneable
public class DRand extends DoubleRandomEngine
Quick medium quality uniform pseudo-random number generator. Produces uniformly distributed int's and long's in the closed intervals [Integer.MIN_VALUE,Integer.MAX_VALUE] and [Long.MIN_VALUE,Long.MAX_VALUE], respectively, as well as float's and double's in the open unit intervals (0.0f,1.0f) and (0.0,1.0), respectively.The seed can be any integer satisfying 0 < 4*seed+1 < 232. In other words, there must hold seed >= 0 && seed < 1073741823.
Quality: This generator follows the multiplicative congruential method of the form
- z(i+1) = a * z(i) (mod m) with a=663608941 (=0X278DDE6DL), m=232.
- z(i) assumes all different values 0 < 4*seed+1 < m during a full period of 230.
Performance: TO_DO
Implementation: TO_DO
Note that this implementation is not synchronized.
- See Also:
DoubleMersenneTwister,Random, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static intDEFAULT_SEED
-
Constructor Summary
Constructors Constructor and Description DRand()Constructs and returns a random number generator with a default seed, which is a constant.DRand(java.util.Date d)Constructs and returns a random number generator seeded with the given date.DRand(int seed)Constructs and returns a random number generator with the given seed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intnextInt()Returns a 32 bit uniformly distributed random number in the closed interval [Integer.MIN_VALUE,Integer.MAX_VALUE] (including Integer.MIN_VALUE and Integer.MAX_VALUE).-
Methods inherited from class cern.jet.random.tdouble.engine.DoubleRandomEngine
apply, apply, apply, makeDefault, nextDouble, nextFloat, nextLong, raw
-
Methods inherited from class cern.colt.PersistentObject
clone
-
-
-
-
Field Detail
-
DEFAULT_SEED
public static final int DEFAULT_SEED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DRand
public DRand()
Constructs and returns a random number generator with a default seed, which is a constant.
-
DRand
public DRand(int seed)
Constructs and returns a random number generator with the given seed.- Parameters:
seed- should not be 0, in such a case DRand.DEFAULT_SEED is substituted.
-
DRand
public DRand(java.util.Date d)
Constructs and returns a random number generator seeded with the given date.- Parameters:
d- typically new java.util.Date()
-
-
Method Detail
-
nextInt
public int nextInt()
Returns a 32 bit uniformly distributed random number in the closed interval [Integer.MIN_VALUE,Integer.MAX_VALUE] (including Integer.MIN_VALUE and Integer.MAX_VALUE).- Specified by:
nextIntin classDoubleRandomEngine
-
-
DMelt 3.0 © DataMelt by jWork.ORG