#include <bdlb_pcgrandomgenerator.h>
This class implements a random number generator (RNG) based on the PCG algorithm.
See bdlb_pcgrandomgenerator
◆ PcgRandomGenerator() [1/3]
bdlb::PcgRandomGenerator::PcgRandomGenerator |
( |
| ) |
|
|
inline |
◆ PcgRandomGenerator() [2/3]
bdlb::PcgRandomGenerator::PcgRandomGenerator |
( |
bsl::uint64_t |
initState, |
|
|
bsl::uint64_t |
streamSelector |
|
) |
| |
|
inline |
Create a PcgRandomGenerator
object and seed it with the optionally specified initState
and streamSelector
. If initState
and streamSelector
are not specified, 0 is used for both. The highest-order bit of streamSelector
is ignored. Note that invoking different instances created with the identical initState
and streamSelector
will result in the same sequence of random numbers from subsequent invocations of generate()
.
◆ PcgRandomGenerator() [3/3]
Create a PcgRandomGenerator
object having the same value as the specified original
object. Note that this newly created object will generate the same sequence of numbers as original
.
◆ generate()
bsl::uint32_t bdlb::PcgRandomGenerator::generate |
( |
| ) |
|
|
inline |
Return the next random number in the sequence generated by this object.
◆ operator=()
Assign to this object the value of the specified rhs
object, and return a non-const
reference to this object. Note that the object after assignment will generate the same sequence of numbers as rhs
.
◆ seed()
void bdlb::PcgRandomGenerator::seed |
( |
bsl::uint64_t |
initState, |
|
|
bsl::uint64_t |
streamSelector |
|
) |
| |
|
inline |
Seed this generator with the specified new initState
and streamSelector
. Note that the sequence of random numbers produced from subsequent invocations of generate()
will be the same as that produced by an object created by PcgRandomGenerator(initState, streamSelector)
.
◆ operator==
Return true
if the specified lhs
and rhs
objects have the same value, and false
otherwise. Two PcgRandomGenerator
objects have the same value if they would produce the same sequence of random numbers from subsequent invocations of generate()
.
The documentation for this class was generated from the following file: