![]() |
fpmas 1.6
|
#include <generator.h>


Public Types | |
| typedef Generator_t::result_type | result_type |
Public Types inherited from fpmas::api::random::Generator< Generator_t::result_type > | |
| typedef Generator_t::result_type | result_type |
Public Member Functions | |
| DistributedGenerator () | |
| DistributedGenerator (api::communication::MpiCommunicator &comm) | |
| DistributedGenerator (result_type seed) | |
| DistributedGenerator (api::communication::MpiCommunicator &comm, result_type seed) | |
| result_type | operator() () override |
| void | seed (result_type seed) override |
| void | discard (unsigned long long z) override |
| virtual Generator_t::result_type | operator() ()=0 |
| virtual void | seed (Generator_t::result_type seed)=0 |
| virtual void | discard (unsigned long long z)=0 |
Static Public Member Functions | |
| static constexpr result_type | min () |
| static constexpr result_type | max () |
Distributed api::random::Generator implementation.
The generator is assumed to produce pseudo-random and deterministic, that are still different on each process.
More particularly, the generator internally uses a Generator_t instance, that must satisfy UniformRandomBitGenerator, seeded differently according to the rank of the process on which the generator is used. Since MPI communications are required to do so, fpmas::init() must be called before the first use of the generator. However, it is safe to instantiate the generator before fpmas::init() is called. This allows to declare a DistributedGenerator as a static variable.
This class meets the requirements of UniformRandomBitGenerator.
| Generator_t | type of the local random number generator used on each process |
| typedef Generator_t::result_type fpmas::random::DistributedGenerator< Generator_t >::result_type |
Integer type used by the generator.
|
inline |
Default DistributedGenerator constructor.
The DistributedGenerator is initialized with a default seed, within the fpmas::communication::WORLD communicator.
|
inline |
DistributedGenerator constructor.
The DistributedGenerator is initialized with a default seed, within the specified communicator.
| comm | MPI communicator |
|
inline |
DistributedGenerator constructor.
The DistributedGenerator is initialized using the provided seed, within the fpmas::communication::WORLD communicator.
| seed | DistributedGenerator seed |
|
inline |
DistributedGenerator constructor.
The DistributedGenerator is initialized using the provided seed, within the specified communicator.
| seed | DistributedGenerator seed |
| comm | MPI communicator |
|
inlineoverridevirtual |
Returns a randomly generated value in [min(), max()].
Implements fpmas::api::random::Generator< Generator_t::result_type >.
|
inlineoverridevirtual |
Seeds the random generator.
| seed | seed value |
Implements fpmas::api::random::Generator< Generator_t::result_type >.
|
inlineoverridevirtual |
Advances the generator internal state as if operator() was called z times.
| z | number of values to discard |
Implements fpmas::api::random::Generator< Generator_t::result_type >.
|
inlinestaticconstexpr |
Minimum value that can be generated.
|
inlinestaticconstexpr |
Maximum value that can be generated.