Lattice Tester Online Documentation 0.1.0-861
Software Package For Testing The Uniformity Of Integral Lattices In The Real Space
Loading...
Searching...
No Matches
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)\).
 
std::int64_t randInt (std::int64_t i, std::int64_t j)
 Return a random integer in \([i, j]\).
 
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]\).
 
std::uint64_t randBits (int64_t s)
 Returns random blocks of \(s\) bits ( \(s\)-bit integers).
 
void setSeed (std::uint64_t seed=GERME)
 Sets the seed of the generator.
 
void setSeed (uint64_t seed)
 

Detailed Description

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

The generator used is the 64-bits generator LFSR258 from L'Ecuyer [8] with period length near \(2^{258}\) for 64-bits machines, and the 32-bits generator LFSR113 from L'Ecuyer [8] 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 ( int64_t s)

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

◆ randInt() [1/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.

◆ randInt() [2/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.

◆ 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() [1/2]

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

Sets the seed of the generator.

If not called, a default seed is used.

◆ setSeed() [2/2]

void LatticeTester::Random::setSeed ( uint64_t seed)