Random number generator.
More...
#include <rnd.hpp>
List of all members.
Public Member Functions |
| Rnd (void) |
| Default constructor that does not initialize the generator.
|
| Rnd (unsigned int s) |
| Initialize with seed s.
|
| Rnd (const Rnd &r) |
| Initialize from generator r.
|
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) |
| Return a random integer from the interval [0..n).
|
bool | initialized (void) const |
| Test whether generator has been properly initialized.
|
Detailed Description
Random number generator.
Definition at line 46 of file rnd.hpp.
Constructor & Destructor Documentation
Gecode::Rnd::Rnd |
( |
void |
|
) |
[inline] |
Default constructor that does not initialize the generator.
Definition at line 91 of file rnd.hpp.
Gecode::Rnd::Rnd |
( |
unsigned int |
s |
) |
|
Initialize with seed s.
Definition at line 49 of file rnd.cpp.
Gecode::Rnd::Rnd |
( |
const Rnd & |
r |
) |
[inline] |
Initialize from generator r.
Definition at line 93 of file rnd.hpp.
Member Function Documentation
void Gecode::Rnd::seed |
( |
unsigned int |
s |
) |
|
Set the current seed to s (initializes if needed).
Definition at line 53 of file rnd.cpp.
void Gecode::Rnd::time |
( |
void |
|
) |
[inline] |
Set current seed based on time (initializes if needed).
Definition at line 96 of file rnd.hpp.
void Gecode::Rnd::hw |
( |
void |
|
) |
[inline] |
Set current seed to hardware-based random number (initializes if needed).
Definition at line 100 of file rnd.hpp.
unsigned int Gecode::Rnd::seed |
( |
void |
|
) |
const [inline] |
Return current seed.
Definition at line 104 of file rnd.hpp.
unsigned int Gecode::Rnd::operator() |
( |
unsigned int |
n |
) |
[inline] |
Return a random integer from the interval [0..n).
Definition at line 109 of file rnd.hpp.
bool Gecode::Rnd::initialized |
( |
void |
|
) |
const [inline] |
Test whether generator has been properly initialized.
Definition at line 114 of file rnd.hpp.
The documentation for this class was generated from the following files: