|
template<typename T = uint64_t, typename S = uint64_t> |
| pcg32 (T initstate=0x853c49e6748fea9bULL, S initseq=0xda3e39cb94b95bdbULL) |
| Constructor.
|
|
void | seed (uint64_t initstate=0x853c49e6748fea9bULL, uint64_t initseq=0xda3e39cb94b95bdbULL) |
| Seed the generator (constructor alias).
|
|
uint32_t | operator() () |
| Draw new random number (uniformly distributed, 0 <= r <= max(uint32_t) ).
|
|
uint32_t | next_uint32 () |
| Draw new random number (uniformly distributed, 0 <= r <= max(uint32_t) ).
|
|
uint32_t | next_uint32 (uint32_t bound) |
| Draw new random number (uniformly distributed, 0 <= r <= bound ).
|
|
float | next_float () |
| Generate a single precision floating point value on the interval [0, 1).
|
|
double | next_double () |
| Generate a double precision floating point value on the interval [0, 1).
|
|
double | next_positive_double () |
| Generate a double precision floating point value on the interval (0, 1).
|
|
uint64_t | state () const |
| The current "state" of the generator.
|
|
template<typename R > |
R | state () |
| The current "state" of the generator.
|
|
uint64_t | initstate () const |
| The state initiator that was used upon construction.
|
|
template<typename R > |
R | initstate () const |
| The state initiator that was used upon construction.
|
|
uint64_t | initseq () const |
| The sequence initiator that was used upon construction.
|
|
template<typename R > |
R | initseq () const |
| The sequence initiator that was used upon construction.
|
|
template<typename T > |
void | restore (T state) |
| Restore a given state in the sequence.
|
|
int64_t | operator- (const pcg32 &other) const |
| The distance between two PCG32 pseudorandom number generators.
|
|
template<typename R = int64_t> |
R | distance (const pcg32 &other) const |
| The distance between two PCG32 pseudorandom number generators.
|
|
template<typename R = int64_t, typename T , std::enable_if_t< std::is_integral< T >::value, bool > = true> |
R | distance (T other_state) const |
| The distance between two states.
|
|
template<typename T > |
void | advance (T distance) |
| Multi-step advance function (jump-ahead, jump-back).
|
|
bool | operator== (const pcg32 &other) const |
| Equality operator.
|
|
bool | operator!= (const pcg32 &other) const |
| Inequality operator.
|
|
double | cumsum_random (size_t n) |
| Result of the cumulative sum of n random numbers.
|
|
double | cumsum_delta (size_t n, double scale=1) |
| Result of the cumulative sum of n 'random' numbers, distributed according to a delta distribution,.
|
|
double | cumsum_exponential (size_t n, double scale=1) |
| Result of the cumulative sum of n random numbers, distributed according to an exponential distribution, see exponential_distribution(),.
|
|
double | cumsum_power (size_t n, double k=1) |
| Result of the cumulative sum of n random numbers, distributed according to a power distribution, see power_distribution(),.
|
|
double | cumsum_gamma (size_t n, double k=1, double scale=1) |
| Result of the cumulative sum of n random numbers, distributed according to a gamma distribution, see gamma_distribution(),.
|
|
double | cumsum_pareto (size_t n, double k=1, double scale=1) |
| Result of the cumulative sum of n random numbers, distributed according to a Pareto distribution, see pareto_distribution(),.
|
|
double | cumsum_weibull (size_t n, double k=1, double scale=1) |
| Result of the cumulative sum of n random numbers, distributed according to a weibull distribution, see weibull_distribution(),.
|
|
double | cumsum_normal (size_t n, double mu=0, double sigma=1) |
| Result of the cumulative sum of n random numbers, distributed according to a normal distribution, see normal_distribution(),.
|
|
void | shuffle (Iterator begin, Iterator end) |
| Draw uniformly distributed permutation and permute the given STL container.
|
|
auto | decide (const P &p) -> typename detail::return_type< bool, P >::type |
| Decide based on probability per value.
|
|
R | decide (const P &p) |
| Decide based on probability per value.
|
|
void | decide (const P &p, R &ret) |
| Decide based on probability per value.
|
|
auto | decide_masked (const P &p, const T &mask) -> typename detail::return_type< bool, P >::type |
| Decide based on probability per value.
|
|
R | decide_masked (const P &p, const T &mask) |
| Decide based on probability per value.
|
|
void | decide_masked (const P &p, const T &mask, R &ret) |
| Decide based on probability per value.
|
|
double | random () |
| Generate a random number \( 0 \leq r \leq 1 \).
|
|
auto | random (const S &shape) -> typename detail::return_type< double, S >::type |
| Generate an nd-array of random numbers \( 0 \leq r \leq 1 \).
|
|
R | random (const S &shape) |
| Generate an nd-array of random numbers \( 0 \leq r \leq 1 \).
|
|
auto | random (const I(&shape)[L]) -> typename detail::return_type_fixed< double, L >::type |
| Generate an nd-array of random numbers \( 0 \leq r \leq 1 \).
|
|
R | random (const I(&shape)[L]) |
| Generate an nd-array of random numbers \( 0 \leq r \leq 1 \).
|
|
T | randint (T high) |
| Generate a random integer \( 0 \leq r < bound \).
|
|
auto | randint (const S &shape, T high) -> typename detail::return_type< T, S >::type |
| Generate an nd-array of random integers \( 0 \leq r \leq bound \).
|
|
R | randint (const S &shape, T high) |
| Generate an nd-array of random integers \( 0 \leq r \leq bound \).
|
|
auto | randint (const I(&shape)[L], T high) -> typename detail::return_type_fixed< T, L >::type |
| Generate an nd-array of random integers \( 0 \leq r \leq bound \).
|
|
R | randint (const I(&shape)[L], T high) |
| Generate an nd-array of random integers \( 0 \leq r \leq bound \).
|
|
auto | randint (const S &shape, T low, U high) -> typename detail::return_type< T, S >::type |
| Generate an nd-array of random integers \( low \leq r < high \).
|
|
R | randint (const S &shape, T low, U high) |
| Generate an nd-array of random integers \( low \leq r < high \).
|
|
auto | randint (const I(&shape)[L], T low, U high) -> typename detail::return_type_fixed< T, L >::type |
| Generate an nd-array of random integers \( low \leq r < high \).
|
|
R | randint (const I(&shape)[L], T low, U high) |
| Generate an nd-array of random integers \( low \leq r < high \).
|
|
double | delta (double scale=1) |
| Return a number distributed according to a delta distribution.
|
|
auto | delta (const S &shape, double scale=1) -> typename detail::return_type< double, S >::type |
| Generate an nd-array of numbers that are delta distribution.
|
|
R | delta (const S &shape, double scale=1) |
| Generate an nd-array of numbers that are delta distribution.
|
|
auto | delta (const I(&shape)[L], double scale=1) -> typename detail::return_type_fixed< double, L >::type |
| Generate an nd-array of numbers that are delta distribution.
|
|
R | delta (const I(&shape)[L], double scale=1) |
| Generate an nd-array of numbers that are delta distribution.
|
|
double | exponential (double scale=1) |
| Return a random number distributed according to an exponential distribution.
|
|
auto | exponential (const S &shape, double scale=1) -> typename detail::return_type< double, S >::type |
| Generate an nd-array of random numbers distributed according to an exponential distribution.
|
|
R | exponential (const S &shape, double scale=1) |
| Generate an nd-array of random numbers distributed according to an exponential distribution.
|
|
auto | exponential (const I(&shape)[L], double scale=1) -> typename detail::return_type_fixed< double, L >::type |
| Generate an nd-array of random numbers distributed according to an exponential distribution.
|
|
R | exponential (const I(&shape)[L], double scale=1) |
| Generate an nd-array of random numbers distributed according to an exponential distribution.
|
|
double | power (double k=1) |
| Return a random number distributed according to an power distribution.
|
|
auto | power (const S &shape, double k=1) -> typename detail::return_type< double, S >::type |
| Generate an nd-array of random numbers distributed according to an power distribution.
|
|
R | power (const S &shape, double k=1) |
| Generate an nd-array of random numbers distributed according to an power distribution.
|
|
auto | power (const I(&shape)[L], double k=1) -> typename detail::return_type_fixed< double, L >::type |
| Generate an nd-array of random numbers distributed according to an power distribution.
|
|
R | power (const I(&shape)[L], double k=1) |
| Generate an nd-array of random numbers distributed according to an power distribution.
|
|
double | gamma (double k=1, double scale=1) |
| Return a random number distributed according to a Gamma distribution.
|
|
auto | gamma (const S &shape, double k=1, double scale=1) -> typename detail::return_type< double, S >::type |
| Generate an nd-array of random numbers distributed according to a Gamma distribution.
|
|
R | gamma (const S &shape, double k=1, double scale=1) |
| Generate an nd-array of random numbers distributed according to a Gamma distribution.
|
|
auto | gamma (const I(&shape)[L], double k=1, double scale=1) -> typename detail::return_type_fixed< double, L >::type |
| Generate an nd-array of random numbers distributed according to a Gamma distribution.
|
|
R | gamma (const I(&shape)[L], double k=1, double scale=1) |
| Generate an nd-array of random numbers distributed according to a Gamma distribution.
|
|
double | pareto (double k=1, double scale=1) |
| Return a random number distributed according to a Pareto distribution.
|
|
auto | pareto (const S &shape, double k=1, double scale=1) -> typename detail::return_type< double, S >::type |
| Generate an nd-array of random numbers distributed according to a Pareto distribution.
|
|
R | pareto (const S &shape, double k=1, double scale=1) |
| Generate an nd-array of random numbers distributed according to a Pareto distribution.
|
|
auto | pareto (const I(&shape)[L], double k=1, double scale=1) -> typename detail::return_type_fixed< double, L >::type |
| Generate an nd-array of random numbers distributed according to a Pareto distribution.
|
|
R | pareto (const I(&shape)[L], double k=1, double scale=1) |
| Generate an nd-array of random numbers distributed according to a Pareto distribution.
|
|
double | weibull (double k=1, double scale=1) |
| Return a random number distributed according to a Weibull distribution.
|
|
auto | weibull (const S &shape, double k=1, double scale=1) -> typename detail::return_type< double, S >::type |
| Generate an nd-array of random numbers distributed according to a Weibull distribution.
|
|
R | weibull (const S &shape, double k=1, double scale=1) |
| Generate an nd-array of random numbers distributed according to a Weibull distribution.
|
|
auto | weibull (const I(&shape)[L], double k=1, double scale=1) -> typename detail::return_type_fixed< double, L >::type |
| Generate an nd-array of random numbers distributed according to a Weibull distribution.
|
|
R | weibull (const I(&shape)[L], double k=1, double scale=1) |
| Generate an nd-array of random numbers distributed according to a Weibull distribution.
|
|
double | normal (double mu=0, double sigma=1) |
| Return a random number distributed according to a normal distribution.
|
|
auto | normal (const S &shape, double mu=0, double sigma=1) -> typename detail::return_type< double, S >::type |
| Generate an nd-array of random numbers distributed according to a normal distribution.
|
|
R | normal (const S &shape, double mu=0, double sigma=1) |
| Generate an nd-array of random numbers distributed according to a normal distribution.
|
|
auto | normal (const I(&shape)[L], double mu=0, double sigma=1) -> typename detail::return_type_fixed< double, L >::type |
| Generate an nd-array of random numbers distributed according to a normal distribution.
|
|
R | normal (const I(&shape)[L], double mu=0, double sigma=1) |
| Generate an nd-array of random numbers distributed according to a normal distribution.
|
|
double | draw (enum prrng::distribution distribution, std::vector< double > parameters=std::vector< double >{}, bool append_default=true) |
| Get a random number according to some distribution.
|
|
R | draw (const S &shape, enum prrng::distribution distribution, std::vector< double > parameters=std::vector< double >{}, bool append_default=true) |
| Get an nd-array of random numbers according to some distribution.
|
|
double | cumsum (size_t n, enum prrng::distribution distribution, std::vector< double > parameters=std::vector< double >{}, bool append_default=true) |
| Get the cumulative sum of n random numbers according to some distribution.
|
|
Random number generate using the pcg32 algorithm.
The class generate random 32-bit random numbers (of type uint32_t
). In addition, they can be converted to nd-arrays of random floating-point numbers (according) using derived methods from Generate().
The algorithm is full based on:
The PCG random number generator was developed by Melissa O'Neill
<oneill@pcg-random.org>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For additional information about the PCG random number generation scheme,
including its license and other licensing options, visit
http://www.pcg-random.org
Whereby most code is taken from the follow wrapper:
Wenzel Jakob, February 2015
https://github.com/wjakob/pcg32
Definition at line 2873 of file prrng.h.