QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Uniform random number generator. More...
#include <xoshiro256starstaruniformrng.hpp>
Public Types | |
typedef Sample< Real > | sample_type |
Public Member Functions | |
Xoshiro256StarStarUniformRng (std::uint64_t seed=0) | |
Xoshiro256StarStarUniformRng (std::uint64_t s0, std::uint64_t s1, std::uint64_t s2, std::uint64_t s3) | |
sample_type | next () const |
Real | nextReal () const |
return a random number in the (0.0, 1.0)-interval More... | |
std::uint64_t | nextInt64 () const |
return a random integer in the [0,0xffffffffffffffffULL]-interval More... | |
Static Private Member Functions | |
static std::uint64_t | rotl (std::uint64_t x, std::int32_t k) |
Private Attributes | |
std::uint64_t | s0_ |
std::uint64_t | s1_ |
std::uint64_t | s2_ |
std::uint64_t | s3_ |
Uniform random number generator.
xoshiro256** random number generator of period 2**256-1
For more details see https://prng.di.unimi.it/ and its reference implementation https://prng.di.unimi.it/xoshiro256starstar.c
Definition at line 56 of file xoshiro256starstaruniformrng.hpp.
typedef Sample<Real> sample_type |
Definition at line 58 of file xoshiro256starstaruniformrng.hpp.
|
explicit |
If the given seed is 0, a random seed will be chosen based on clock().
Definition at line 54 of file xoshiro256starstaruniformrng.cpp.
Xoshiro256StarStarUniformRng | ( | std::uint64_t | s0, |
std::uint64_t | s1, | ||
std::uint64_t | s2, | ||
std::uint64_t | s3 | ||
) |
Make sure that s0, s1, s2 and s3 are chosen randomly. Otherwise, the results of the first random numbers might not be well distributed. Especially s0 = s1 = s2 = s3 = 0 does not work and will always return 0.
Definition at line 62 of file xoshiro256starstaruniformrng.cpp.
sample_type next | ( | ) | const |
returns a sample with weight 1.0 containing a random number in the (0.0, 1.0) interval
Definition at line 70 of file xoshiro256starstaruniformrng.hpp.
Real nextReal | ( | ) | const |
return a random number in the (0.0, 1.0)-interval
Definition at line 73 of file xoshiro256starstaruniformrng.hpp.
std::uint64_t nextInt64 | ( | ) | const |
return a random integer in the [0,0xffffffffffffffffULL]-interval
Definition at line 76 of file xoshiro256starstaruniformrng.hpp.
|
staticprivate |
Definition at line 94 of file xoshiro256starstaruniformrng.hpp.
|
mutableprivate |
Definition at line 95 of file xoshiro256starstaruniformrng.hpp.
|
private |
Definition at line 95 of file xoshiro256starstaruniformrng.hpp.
|
private |
Definition at line 95 of file xoshiro256starstaruniformrng.hpp.
|
private |
Definition at line 95 of file xoshiro256starstaruniformrng.hpp.