- Inherits from:
- Object
- Conforms to:
- DRandomable
- Declared in:
- DLRnd.h
Object
|
+---DLRnd
Class Description
The DLRnd class implements a pseudo random generator bases on a
generalized feedback shift register random generator. It is not as
fast as the generator used in the class DRnd but this one passes the
Marsaglia's 'Diehard' statistical tests and it has a long period
of 2^800. This class is 'inspired' by the code present on the site
http://remus.rutgers.edu/~rhoads
- Last modified:
- 31-Oct-2007 (DLRnd.h)
Instance Variables
- private uint32_t _seeds[25]
- the seeds for the generator
- private int _index
- the index in the seeds
- Constructors
- - (DLRnd *) init
- Initialise a non-seeded random generator
- Returns:
- the object
- - (DLRnd *) init :(unsigned long) seed
- Initialise a seeded random generator
- Parameters:
- seed - the seed to be used
- Returns:
- the object
- Member methods
- - (DLRnd *) 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 from the generator
- Returns:
- the next integer
- - (int) nextInt :(int) from :(int) to
- Get the next ranged integer 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 from the generator
- Returns:
- the next long
- - (long) nextLong :(long) from :(long) to
- Get the next ranged long 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