QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
Uniform random number generator. More...
#include <knuthuniformrng.hpp>
Public Types | |
typedef Sample< Real > | sample_type |
Public Member Functions | |
KnuthUniformRng (long seed=0) | |
sample_type | next () const |
Private Member Functions | |
double | mod_sum (double x, double y) const |
bool | is_odd (int s) const |
void | ranf_start (long seed) |
void | ranf_array (std::vector< double > &aa, int n) const |
double | ranf_arr_cycle () const |
Private Attributes | |
std::vector< double > | ranf_arr_buf |
size_t | ranf_arr_ptr |
size_t | ranf_arr_sentinel |
std::vector< double > | ran_u |
Static Private Attributes | |
static const int | KK = 100 |
static const int | LL = 37 |
static const int | TT = 70 |
static const int | QUALITY = 1009 |
Uniform random number generator.
Random number generator by Knuth. For more details see Knuth, Seminumerical Algorithms, 3rd edition, Section 3.6.
Definition at line 44 of file knuthuniformrng.hpp.
typedef Sample<Real> sample_type |
Definition at line 46 of file knuthuniformrng.hpp.
|
explicit |
if the given seed is 0, a random seed will be chosen based on clock()
Definition at line 30 of file knuthuniformrng.cpp.
KnuthUniformRng::sample_type next | ( | ) | const |
returns a sample with weight 1.0 containing a random number uniformly chosen from (0.0,1.0)
Definition at line 68 of file knuthuniformrng.hpp.
|
private |
|
private |
|
private |
Definition at line 36 of file knuthuniformrng.cpp.
|
private |
Definition at line 75 of file knuthuniformrng.cpp.
|
private |
Definition at line 84 of file knuthuniformrng.cpp.
|
staticprivate |
Definition at line 54 of file knuthuniformrng.hpp.
|
staticprivate |
Definition at line 54 of file knuthuniformrng.hpp.
|
staticprivate |
Definition at line 54 of file knuthuniformrng.hpp.
|
staticprivate |
Definition at line 54 of file knuthuniformrng.hpp.
|
mutableprivate |
Definition at line 55 of file knuthuniformrng.hpp.
|
mutableprivate |
Definition at line 56 of file knuthuniformrng.hpp.
|
private |
Definition at line 56 of file knuthuniformrng.hpp.
|
mutableprivate |
Definition at line 57 of file knuthuniformrng.hpp.