- Inherits from:
- Object
- Conforms to:
- DRandomable
- Declared in:
- DMRnd.h
Object
|
+---DMRnd
Class Description
The DMRnd class implements a pseudo random generator bases on the
Mersenne Twister pseudo random generator. It is not only very fast,
but it also passes the Marsaglia's 'Diehard' statistical tests and
it has a very long period of 2^19937 - 1.
- Last modified:
- 31-Oct-2007 (DMRnd.h)
Instance Variables
- private uint32_t _mt[DMRD_N]
- the state
- private int _mti
- the index in state
- Constructors
- - (DMRnd *) init
- Initialise a non-seeded random generator
- Returns:
- the object
- - (DMRnd *) init :(unsigned long) seed
- Initialise a seeded random generator
- Parameters:
- seed - the seed to be used
- Returns:
- the object
- Member methods
- - (DMRnd *) seed :(unsigned long) seed
- Set the seed for the random generator
- Parameters:
- seed - the seed for the random generator
- Returns:
- the object
- Random generator methods
- - (double) nextDouble
- Get the next double from the generator (0 <= d < 1)
- Returns:
- the next double
- - (double) nextDouble :(double) from :(double) to
- Get the next double from the generator (from <= dE < to)
- Parameters:
- from - the start of the range
to - the end of the range
- Returns:
- the next double
- - (int) nextInt
- Get the next integer (32 bit) from the generator
- Returns:
- the next integer
- - (int) nextInt :(int) from :(int) to
- Get the next ranged integer (32 bit) from the generator
- Parameters:
- from - the start of the range
to - the end of the range
- Returns:
- the next integer
- - (long) nextLong
- Get the next long (32 bit) from the generator
- Returns:
- the next long
- - (long) nextLong :(long) from :(long) to
- Get the next ranged long (32 bit) from the generator
- Parameters:
- from - the start of the range
to - the end of the range
- Returns:
- the next long
generated 05-Nov-2007 by ObjcDoc 3.0.0