3#include <Foundation/Containers/DynamicArray.h>
4#include <Foundation/IO/Stream.h>
5#include <Foundation/Math/Declarations.h>
14 void Initialize(plUInt64 uiSeed);
18 void InitializeFromCurrentTime();
33 plUInt32 UIntInRange(plUInt32 uiRange);
39 plInt32 IntInRange(plInt32 iMinValue, plUInt32 uiRange);
42 plInt32 IntMinMax(plInt32 iMinValue, plInt32 iMaxValue);
45 PL_ALWAYS_INLINE
bool Bool() {
return static_cast<bool>(UInt() & 1); }
54 double DoubleInRange(
double fMinValue,
double fRange);
57 double DoubleMinMax(
double fMinValue,
double fMaxValue);
60 double DoubleVariance(
double fValue,
double fVariance);
63 double DoubleVarianceAroundZero(
double fAbsMaxValue);
72 PL_ALWAYS_INLINE
float FloatInRange(
float fMinValue,
float fRange) {
return static_cast<float>(DoubleInRange(fMinValue, fRange)); }
75 PL_ALWAYS_INLINE
float FloatMinMax(
float fMinValue,
float fMaxValue) {
return static_cast<float>(DoubleMinMax(fMinValue, fMaxValue)); }
78 PL_ALWAYS_INLINE
float FloatVariance(
float fValue,
float fVariance) {
return static_cast<float>(DoubleVariance(fValue, fVariance)); }
81 PL_ALWAYS_INLINE
float FloatVarianceAroundZero(
float fAbsMaxValue) {
return static_cast<float>(DoubleVarianceAroundZero(fAbsMaxValue)); }
85 plUInt32 m_uiState[16];
99 void Initialize(plUInt64 uiRandomSeed, plUInt32 uiMaxValue,
float fVariance = 1.0f);
102 plUInt32 UnsignedValue();
105 plInt32 SignedValue();
114 void SetupTable(plUInt32 uiMaxValue,
float fSigma);
122#include <Foundation/Math/Implementation/AllClassesRandom_inl.h>
Definition DynamicArray.h:81
A random number generator that produces values with a normal / Gaussian distribution.
Definition Random.h:91
A random number generator. Currently uses the WELL512 algorithm.
Definition Random.h:9
PL_ALWAYS_INLINE float FloatMinMax(float fMinValue, float fMaxValue)
Returns a float value in range [fMinValue ; fMaxValue].
Definition Random.h:75
PL_ALWAYS_INLINE bool Bool()
Returns a boolean either being true or false.
Definition Random.h:45
PL_ALWAYS_INLINE float FloatInRange(float fMinValue, float fRange)
Returns a float value in range [fMinValue ; fMinValue + fRange)
Definition Random.h:72
PL_ALWAYS_INLINE float FloatVariance(float fValue, float fVariance)
Returns a float value around fValue with a given variance (0 - 1 range)
Definition Random.h:78
PL_ALWAYS_INLINE float FloatVarianceAroundZero(float fAbsMaxValue)
Returns a float value between [-fAbsMaxValue; +fAbsMaxValue] with a Gaussian distribution.
Definition Random.h:81
PL_ALWAYS_INLINE float FloatZeroToOneExclusive()
Returns a value in range [0.0 ; 1.0), ie. including zero, but excluding one.
Definition Random.h:66
PL_ALWAYS_INLINE double DoubleZeroToOneExclusive()
Returns a value in range [0.0 ; 1.0), ie. including zero, but excluding one.
Definition Random.h:48
PL_ALWAYS_INLINE float FloatZeroToOneInclusive()
Returns a value in range [0.0 ; 1.0], ie. including zero and one.
Definition Random.h:69
PL_ALWAYS_INLINE double DoubleZeroToOneInclusive()
Returns a value in range [0.0 ; 1.0], ie. including zero and one.
Definition Random.h:51
Interface for binary in (read) streams.
Definition Stream.h:22
Interface for binary out (write) streams.
Definition Stream.h:107