RanQD1 Class Reference

List of all members.

Public Member Functions

 RanQD1 (long seed)
void setSeed (long seed)
long nextLong ()
double nextDouble ()
int nextInt (int min, int max)

Detailed Description

This class implements the (repeatable) "quick and dirty" portable pseudo-random generator with modulus 232 in W. H. Press et al, "Numerical Recipes in C: The Art of Scientific Computing", Cambridge University Press, 2nd Ed., 1992, with values recommended by Knuth. It is the fastest generator recommended in the above tome.

The original relies on the fact that in C on a 32-bit machine, multiplying two unsigned long ints returns the lower 32 bits of the 64 bit product. Since we are using Java (no unsigned ints) and a 64-bit architecture, we mimic this using 64 bit longs with bit-masking instead.

Author:
ahref="http://www.csse.uwa.edu.au/~cara/">CaraMacNish</a>,UniversityofWesternAustralia@version1.0RC1,7thNov2007<br>Forthelatestversionandadditionalinformationseethe@link<ahref="http://www.cs.bham.ac.uk/research/projects/ecb/">BirminghamRepository</a>

Definition at line 26 of file RanQD1.java.


Constructor & Destructor Documentation

RanQD1::RanQD1 ( long  seed  )  [inline]

Create a new pseudo-random generator.

Parameters:
seed the seed

Definition at line 39 of file RanQD1.java.

Here is the call graph for this function:


Member Function Documentation

double RanQD1::nextDouble (  )  [inline]

Get the next double.

Definition at line 64 of file RanQD1.java.

Here is the call graph for this function:

int RanQD1::nextInt ( int  min,
int  max 
) [inline]

Get an integer with equal probability from [min, max] inclusive.

Definition at line 71 of file RanQD1.java.

Here is the call graph for this function:

long RanQD1::nextLong (  )  [inline]

Get the next long.

Definition at line 56 of file RanQD1.java.

void RanQD1::setSeed ( long  seed  )  [inline]

Reset the seed (quicker than creating a new instance).

Parameters:
seed the seed

Definition at line 48 of file RanQD1.java.

Here is the call graph for this function:


The documentation for this class was generated from the following file:

Generated on Sun May 9 12:26:14 2010 for Realea by  doxygen 1.6.1