OpendTect
7.0
|
Uniform Random Generator Not thread-safe to preserve performance. In multi-threaded context, use one generator per thread. More...
Public Member Functions | |
RandGen () | |
double | get () const override |
Uniform [0-1]. More... | |
int | getIndex (int sz) const |
random index in the range [0,sz> More... | |
od_int64 | getIndex (od_int64 sz) const |
random index in the range [0,sz> More... | |
int | getIndexFast (int sz, int) const |
od_int64 | getIndexFast (od_int64 sz, od_int64) const |
int | getInt () const |
Uniform int. More... | |
int | getInt (int min, int max) const |
random int in the range [min,max]> More... | |
bool | init (int seed) override |
Not for production. More... | |
template<class ODSET > | |
void | subselect (ODSET &ods, od_int64 targetsz) const |
template<class T > | |
void | subselect (T &, od_int64 targetsz) const |
template<class T , class SzTp > | |
void | subselect (T *, SzTp sz, SzTp targetsz) const |
Public Member Functions inherited from Stats::RandomGenerator | |
virtual | ~RandomGenerator () |
Private Member Functions | |
mOD_DisableCopy (RandGen) | |
Private Attributes | |
std::mt19937_64 | gen64_ |
std::mt19937 | gen_ |
std::random_device | rd_ |
Threads::Atomic< int > | seedval_ = mUdf(int) |
Uniform Random Generator Not thread-safe to preserve performance. In multi-threaded context, use one generator per thread.
<>
Stats::RandGen::RandGen | ( | ) |
|
overridevirtual |
Uniform [0-1].
Implements Stats::RandomGenerator.
int Stats::RandGen::getIndex | ( | int | sz | ) | const |
random index in the range [0,sz>
od_int64 Stats::RandGen::getIndex | ( | od_int64 | sz | ) | const |
random index in the range [0,sz>
|
inline |
|
inline |
int Stats::RandGen::getInt | ( | ) | const |
Uniform int.
int Stats::RandGen::getInt | ( | int | min, |
int | max | ||
) | const |
random int in the range [min,max]>
|
overridevirtual |
Not for production.
Reimplemented from Stats::RandomGenerator.
|
private |
|
inline |
void Stats::RandGen::subselect | ( | T & | , |
od_int64 | targetsz | ||
) | const |
Does not preserve order The removed items will really be erased
|
inline |
Does not preserve order. Afterwards, the 'removed' values occupy the indexes targetsz - maxsz-1
|
mutableprivate |
|
mutableprivate |
|
private |
|
private |
Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024