Generated on for Gecode by doxygen 1.17.0

Random number generator. More...

#include <gecode/kernel/data/rnd.hpp>

Public Member Functions

 Rnd (void)
 Default constructor that does not initialize the generator.
 Rnd (const Rnd &r)
 Initialize from generator r.
Rndoperator= (const Rnd &r)
 Assignment operator.
 ~Rnd (void)
 Destructor.
 Rnd (unsigned int s)
 Initialize with seed s.
void seed (unsigned int s)
 Set the current seed to s (initializes if needed).
void time (void)
 Set current seed based on time (initializes if needed).
void hw (void)
 Set current seed to hardware-based random number (initializes if needed).
unsigned int seed (void) const
 Return current seed.
unsigned int operator() (unsigned int 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 long long int operator() (unsigned long long 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)\).
Public Member Functions inherited from Gecode::SharedHandle
 SharedHandle (void)
 Create shared handle with no object pointing to.
 SharedHandle (SharedHandle::Object *so)
 Create shared handle that points to shared object so.
 SharedHandle (const SharedHandle &sh)
 Copy constructor maintaining reference count.
SharedHandleoperator= (const SharedHandle &sh)
 Assignment operator maintaining reference count.
 ~SharedHandle (void)
 Destructor that maintains reference count.
 operator bool (void) const
 Whether handle points to an object.

Additional Inherited Members

Protected Member Functions inherited from Gecode::SharedHandle
SharedHandle::Objectobject (void) const
 Access to the shared object.
void object (SharedHandle::Object *n)
 Modify shared object.

Detailed Description

Random number generator.

Definition at line 42 of file rnd.hpp.

Constructor & Destructor Documentation

◆ Rnd() [1/3]

Gecode::Rnd::Rnd ( void )

Default constructor that does not initialize the generator.

◆ Rnd() [2/3]

Gecode::Rnd::Rnd ( const Rnd & r)

Initialize from generator r.

◆ ~Rnd()

Gecode::Rnd::~Rnd ( void )

Destructor.

◆ Rnd() [3/3]

Gecode::Rnd::Rnd ( unsigned int s)

Initialize with seed s.

Member Function Documentation

◆ operator=()

Rnd & Gecode::Rnd::operator= ( const Rnd & r)

Assignment operator.

◆ seed() [1/2]

void Gecode::Rnd::seed ( unsigned int s)

Set the current seed to s (initializes if needed).

◆ time()

void Gecode::Rnd::time ( void )

Set current seed based on time (initializes if needed).

◆ hw()

void Gecode::Rnd::hw ( void )

Set current seed to hardware-based random number (initializes if needed).

◆ seed() [2/2]

unsigned int Gecode::Rnd::seed ( void ) const
inline

Return current seed.

Definition at line 156 of file rnd.hpp.

◆ operator()() [1/4]

unsigned int Gecode::Rnd::operator() ( unsigned int n)
inline

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

Definition at line 161 of file rnd.hpp.

◆ operator()() [2/4]

int Gecode::Rnd::operator() ( int n)
inline

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

Definition at line 166 of file rnd.hpp.

◆ operator()() [3/4]

unsigned long long int Gecode::Rnd::operator() ( unsigned long long int n)
inline

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

Definition at line 171 of file rnd.hpp.

◆ operator()() [4/4]

long long int Gecode::Rnd::operator() ( long long int n)
inline

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

Definition at line 176 of file rnd.hpp.


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