Generated on for Gecode by doxygen 1.17.0
Gecode::Support::LinearCongruentialGenerator< m, a, q, r > Class Template Reference

Template for linear congruential generators. More...

#include <gecode/support/random.hpp>

Public Types

typedef unsigned int result_type
 Type of the produced values.

Public Member Functions

void seed (unsigned int s)
 Set the current seed to s.
 LinearCongruentialGenerator (unsigned int s=1)
 Construct the generator instance with seed s.
unsigned int seed (void) const
 Return current seed.
unsigned int next (void)
 Generate next number in series.
template<class Type>
Type operator() (Type n)
 Returns a random integer from the interval \([0\ldots n)\).
int operator() (int n)
 Returns a random integer from the interval \([0\ldots n)\).
unsigned int operator() (unsigned int n)
 Returns a random integer from the interval \([0\ldots n)\).
long long int operator() (long long int n)
 Returns a random integer from the interval \([0\ldots n)\).
size_t size (void) const
 Report size occupied.
result_type operator() ()
 Returns a random integer from the interval \([0\ldots max()]\).

Static Public Member Functions

static constexpr result_type min ()
 Minimum value that may be produced when no bound is specified.
static constexpr result_type max ()
 Maximum value that may be produced when no bound is specified.

Detailed Description

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
class Gecode::Support::LinearCongruentialGenerator< m, a, q, r >

Template for linear congruential generators.

This class template defines a simple class for linear congruential generators.

Definition at line 48 of file random.hpp.

Member Typedef Documentation

◆ result_type

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
typedef unsigned int Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::result_type

Type of the produced values.

Definition at line 81 of file random.hpp.

Constructor & Destructor Documentation

◆ LinearCongruentialGenerator()

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::LinearCongruentialGenerator ( unsigned int s = 1)
inline

Construct the generator instance with seed s.

Definition at line 106 of file random.hpp.

Member Function Documentation

◆ seed() [1/2]

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
void Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::seed ( unsigned int s)
inline

Set the current seed to s.

Definition at line 100 of file random.hpp.

◆ seed() [2/2]

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
unsigned int Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::seed ( void ) const
inline

Return current seed.

Definition at line 112 of file random.hpp.

◆ next()

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
unsigned int Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::next ( void )
inline

Generate next number in series.

Definition at line 92 of file random.hpp.

◆ operator()() [1/5]

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
template<class Type>
Type Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::operator() ( Type n)
inline

Returns a random integer from the interval \([0\ldots n)\).

Definition at line 144 of file random.hpp.

◆ operator()() [2/5]

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
int Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::operator() ( int n)
inline

Returns a random integer from the interval \([0\ldots n)\).

Definition at line 154 of file random.hpp.

◆ operator()() [3/5]

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
unsigned int Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::operator() ( unsigned int n)
inline

Returns a random integer from the interval \([0\ldots n)\).

Definition at line 149 of file random.hpp.

◆ operator()() [4/5]

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
long long int Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::operator() ( long long int n)
inline

Returns a random integer from the interval \([0\ldots n)\).

Definition at line 160 of file random.hpp.

◆ size()

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
size_t Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::size ( void ) const
inline

Report size occupied.

Definition at line 167 of file random.hpp.

◆ min()

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
constexpr result_type Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::min ( )
inlinestaticconstexpr

Minimum value that may be produced when no bound is specified.

Definition at line 83 of file random.hpp.

◆ max()

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
constexpr result_type Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::max ( )
inlinestaticconstexpr

Maximum value that may be produced when no bound is specified.

Definition at line 85 of file random.hpp.

◆ operator()() [5/5]

template<unsigned int m, unsigned int a, unsigned int q, unsigned int r>
result_type Gecode::Support::LinearCongruentialGenerator< m, a, q, r >::operator() ( )
inline

Returns a random integer from the interval \([0\ldots max()]\).

Definition at line 87 of file random.hpp.


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