Ref T486 Using QRandomGenerator.

This commit is contained in:
Mat Sutcliffe
2018-12-25 15:29:25 +00:00
parent bd9948bbff
commit dd655bcb25
8 changed files with 45 additions and 34 deletions

View File

@@ -14,6 +14,7 @@
#include "blackmisc/blackmiscexport.h"
#include <QRandomGenerator>
#include <QtCore/qmath.h>
#include <QPair>
#include <cmath>
@@ -115,12 +116,18 @@ namespace BlackMisc
//! Normalize: 0≤ degrees <360
static double normalizeDegrees360(double degrees);
//! Thread-local random generator
static QRandomGenerator &randomGenerator();
//! Random number between low and high
static int randomInteger(int low, int high);
//! Random double 0-max
static double randomDouble(double max = 1);
//! Random boolean
static bool randomBool();
//! Round numToRound to the nearest multiple of divisor
static int roundToMultipleOf(int value, int divisor);