Lattice Tester Guide  1.0-9
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
LatticeTester::Random Namespace Reference

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

Functions

double randU01 ()
 Returns a random number in \([0, 1)\). More...
 
std::int64_t randInt (std::int64_t i, std::int64_t j)
 Return a random integer in \([i, j]\). More...
 
NTL::ZZ randInt (NTL::ZZ i, NTL::ZZ j)
 This is an overload of the previous method to create an NTL::ZZ integer in the range \([i,j]\). More...
 
std::uint64_t randBits (int s)
 Returns random blocks of \(s\) bits ( \(s\)-bit integers). More...
 
void setSeed (std::uint64_t seed=GERME)
 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 [16] with period length near \(2^{258}\) for 64-bits machines, and the 32-bits generator LFSR113 from L'Ecuyer [16] 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.

Function Documentation

◆ randBits()

uint64_t LatticeTester::Random::randBits ( int  s)

Returns random blocks of \(s\) bits ( \(s\)-bit integers).

◆ randInt() [1/2]

std::int64_t LatticeTester::Random::randInt ( std::int64_t  i,
std::int64_t  j 
)

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

The numbers \(i\) and \(j\) can occur. Restriction: \(i < j\). The generated number is limited to 62 bits.

◆ randInt() [2/2]

NTL::ZZ LatticeTester::Random::randInt ( NTL::ZZ  i,
NTL::ZZ  j 
)

This is an overload of the previous method to create an NTL::ZZ integer in the range \([i,j]\).

NTL has a method to generate pseudo random numbers in a given range, but it is not deterministic. This method concatenates random bits until it has a big enough number and tries to assign the correct integer to it.

◆ randU01()

double LatticeTester::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.

◆ setSeed()

void LatticeTester::Random::setSeed ( std::uint64_t  seed = GERME)

Sets the seed of the generator.

If not called, a default seed is used.