Random number generator with uniform distribution. More...
#include <Nimble/Random.hpp>
Public Member Functions | |
| uint32_t | rand () |
| A random number in range 0:2^32-1. More... | |
| float | rand01 () |
| Random numbers between 0 and 1. | |
| float | rand0X (float x) |
| Random numbers between 0 and x. | |
| double | rand0X (double x) |
| Random numbers between 0 and x. | |
| uint32_t | rand0X (uint32_t x) |
| Random numbers between 0 and x-1. | |
| uint64_t | rand0X64 (uint64_t x) |
| 64-bit random numbers between 0 and x-1 | |
| float | rand11 () |
| Random numbers between -1 and 1. | |
| uint32_t | rand24 () |
| A random number in range 0:2^24-1. More... | |
| uint32_t | rand32 () |
| A random number in range 0:2^32-1. More... | |
| bool | randBool () |
| Random boolean. More... | |
| float | randMinMax (float min, float max) |
| Random numbers between min and max. | |
| uint32_t | randN24 (uint32_t range) |
| Get random numbers between 0 and range-1. More... | |
| RandomUniform (unsigned long val=std::mt19937::default_seed) | |
| Constructs a new random number generator with the given seed value. | |
| float | randRange (float a, float b) |
| Random number from range [a, b) if a < b, else [b, a) | |
| Nimble::Vector2f | randVec2InRect (const Nimble::Rectf &r) |
| Random 2d vector inside a rectangle. | |
| Nimble::Vector2f | randVecInCircle (float radius=1.0f) |
| Random 2d vector on or inside a circle. More... | |
| Nimble::Vector3f | randVecInSphere (float radius=1.0f) |
| Random 3d vector inside or on a sphere. More... | |
| Nimble::Vector2f | randVecOnCircle (float radius=1.0f) |
| Random 2d vector on a circle. More... | |
| Nimble::Vector3f | randVecOnSphere (float radius=1.0f) |
| Random 3d vector on a sphere. More... | |
| float | randXX (float x) |
| Random numbers between -x and x. | |
Static Public Member Functions | |
| static RandomUniform & | instance () |
| Returns a reference to an instance. | |
Random number generator with uniform distribution.
This class generates random numbers with uniform distribution.
It uses STL's Mersenne Twister implementation for random number generation.
The random number sequence is identical on all platforms, given the same seed value.
|
inline |
A random number in range 0:2^32-1.
|
inline |
A random number in range 0:2^24-1.
|
inline |
A random number in range 0:2^32-1.
|
inline |
Random boolean.
|
inline |
Get random numbers between 0 and range-1.
| range | The maximum output value. This value must not exceed 2^24-1. |
|
inline |
Random 2d vector on or inside a circle.
| radius | The radius of the circle |
|
inline |
Random 3d vector inside or on a sphere.
| radius | The radius of the sphere |
|
inline |
Random 2d vector on a circle.
| radius | The radius of the circle |
|
inline |
Random 3d vector on a sphere.
| radius | The radius of the sphere |