made randomnumber generators seeded with fixed values
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 154 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@ -5,6 +5,8 @@
|
||||
|
||||
JKQTPAppSettingController::JKQTPAppSettingController(int &argc, char **argv, bool enableHighDPIIfAVailable)
|
||||
{
|
||||
// seed RNG
|
||||
std::srand(123456);
|
||||
bool deactivated=false;
|
||||
for (int i=0; i<argc; i++) {
|
||||
if (QString(argv[i])=="--disablehighdpi") {
|
||||
|
@ -235,9 +235,10 @@ JKQTPAdaptiveFunctionGraphEvaluator::JKQTPAdaptiveFunctionGraphEvaluator(const s
|
||||
minSamples(minSamples_),
|
||||
maxRefinementDegree(maxRefinementDegree_),
|
||||
slopeTolerance(slopeTolerance_),
|
||||
minPixelPerSample(minPixelPerSample_)
|
||||
minPixelPerSample(minPixelPerSample_),
|
||||
rd(), gen{rd()}, dist(0,1)
|
||||
{
|
||||
|
||||
gen.seed(12345);
|
||||
}
|
||||
|
||||
JKQTPAdaptiveFunctionGraphEvaluator::JKQTPAdaptiveFunctionGraphEvaluator(const std::function<QPointF (double)> &fxy_, unsigned int minSamples_, unsigned int maxRefinementDegree_, double slopeTolerance_, double minPixelPerSample_):
|
||||
@ -245,9 +246,10 @@ JKQTPAdaptiveFunctionGraphEvaluator::JKQTPAdaptiveFunctionGraphEvaluator(const s
|
||||
minSamples(minSamples_),
|
||||
maxRefinementDegree(maxRefinementDegree_),
|
||||
slopeTolerance(slopeTolerance_),
|
||||
minPixelPerSample(minPixelPerSample_)
|
||||
minPixelPerSample(minPixelPerSample_),
|
||||
rd(), gen{rd()}, dist(0,1)
|
||||
{
|
||||
|
||||
gen.seed(12345);
|
||||
}
|
||||
|
||||
QVector<QPointF> JKQTPAdaptiveFunctionGraphEvaluator::evaluate(double tmin, double tmax) const
|
||||
@ -285,7 +287,7 @@ void JKQTPAdaptiveFunctionGraphEvaluator::refine(JKQTPAdaptiveFunctionGraphEvalu
|
||||
if (degree>=maxRefinementDegree) return;
|
||||
const double ta=a->first;
|
||||
const double tb=b->first;
|
||||
const double tmid=ta+(tb-ta)*(0.5 +(static_cast<double>(rand())/static_cast<double>(RAND_MAX)-0.5)/5.0);
|
||||
const double tmid=ta+(tb-ta)*(0.5 +(dist(gen)-0.5)/5.0);
|
||||
const QPointF pa=a->second;
|
||||
const QPointF pb=b->second;
|
||||
const QPointF pmid(fxy(tmid));
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <forward_list>
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
#include <random>
|
||||
#include <QDebug>
|
||||
#include "jkqtcommon/jkqtpmathtools.h"
|
||||
#include "jkqtcommon/jkqtpcodestructuring.h"
|
||||
@ -105,6 +106,13 @@ protected:
|
||||
double slopeTolerance;
|
||||
/** \brief create one sample at least every \a minPixelPerSample pixels */
|
||||
double minPixelPerSample;
|
||||
/** \brief random number generation: device */
|
||||
mutable std::random_device rd; // random number generators:
|
||||
/** \brief random number generation: egenrator */
|
||||
mutable std::mt19937 gen;
|
||||
/** \brief random number generation: distribution */
|
||||
mutable std::uniform_real_distribution<double> dist;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 154 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 92 KiB |
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 91 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 176 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 76 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |