A thread-safe random integer generator. More...
#include <UniqueRandom.h>
Public Member Functions | |
| double | uniform () |
| double | uniform (double min, double max) |
| int | uniform (int min, int max) |
| UniqueRandom (int seed) | |
| ~UniqueRandom () | |
A thread-safe random integer generator.
| DinverCore::UniqueRandom::UniqueRandom | ( | int | seed | ) | [inline] |
If seed is null, a random number is calculated from current time.
: Random(seed) {}
| DinverCore::UniqueRandom::~UniqueRandom | ( | ) | [inline] |
{}
| double DinverCore::UniqueRandom::uniform | ( | ) | [inline] |
References QGpCoreTools::Random::ran2().
Referenced by DinverCore::AbstractForward::firstModel(), DinverCore::ImportanceSampling::generate(), DinverCore::Neighborhood::optimization(), DinverCore::PdfCurve::randomValue(), DinverCore::Neighborhood::setThreadCount(), and uniform().
{
QMutexLocker ml (&_mutex);
return Random::ran2();
}
| double DinverCore::UniqueRandom::uniform | ( | double | min, |
| double | max | ||
| ) | [inline] |
Returns a uniform deviate between min and max exclusive.
Reimplemented from QGpCoreTools::Random.
References uniform().
{
QMutexLocker ml (&_mutex);
return Random::uniform(min, max);
}
| int DinverCore::UniqueRandom::uniform | ( | int | min, |
| int | max | ||
| ) | [inline] |
Returns a uniform integer deviate between min and max inclusive.
Reimplemented from QGpCoreTools::Random.
References uniform().
{
QMutexLocker ml (&_mutex);
return Random::uniform(min, max);
}