Lattice Builder Manual
Software Package for Constructing Rank-1 Lattices
LatCommon::Random Class Reference

This class generates random numbers (in fact pseudo-random numbers). More...

#include <Random.h>

Public Member Functions

 Random ()
 Constructor using a default seed for the generator. More...
 
 ~Random ()
 Destructor.
 
double randU01 ()
 Returns a random number in \([0, 1)\). More...
 
int randInt (int i, int j)
 Return a random integer in \([i, j]\). More...
 
unsigned long randBits (int s)
 Returns random blocks of \(s\) bits ( \(s\)-bit integers).
 
void setSeed (unsigned long seed)
 Sets the seed of the generator. More...
 

Detailed Description

This class generates random numbers (in fact pseudo-random numbers).

The generator used is the 64-bits generator LFSR258 from L'Ecuyer [14] with period length near \(2^{258}\) for 64-bits machines, and the 32-bits generator LFSR113 from L'Ecuyer [14] with period length near \(2^{113}\) on 32-bits machines. Thus the random numbers generated will be different on 32-bits and 64-bits machines.

Constructor & Destructor Documentation

LatCommon::Random::Random ( )

Constructor using a default seed for the generator.

One may reset the seed by calling setSeed.

Member Function Documentation

int LatCommon::Random::randInt ( int  i,
int  j 
)

Return a random integer in \([i, j]\).

The numbers \(i\) and \(j\) can occur. Restriction: \(i < j\).

double LatCommon::Random::randU01 ( )

Returns a random number in \([0, 1)\).

The number has 53 random bits of resolution on 64-bits machines, and 32 random bits on 32-bits machines.

void LatCommon::Random::setSeed ( unsigned long  seed)

Sets the seed of the generator.

If not called, a default seed is used.


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