The casual draws: a float, a range, a coin, off a per-thread generator.
More...
|
| Rng & | rng () |
| | Per-thread default generator.
|
| float | value () |
| | Uniform float in [0, 1), from the per-thread generator.
|
| float | range (float min, float max) |
| | Uniform float in [min, max), from the per-thread generator.
|
| int | range (int min, int max) |
| | Uniform integer in [min, max], from the per-thread generator.
|
| bool | boolean () |
| | Fair coin flip, from the per-thread generator.
|
The casual draws: a float, a range, a coin, off a per-thread generator.
For draws that need not reproduce. Anything that must owns and seeds its own Rng: a shared per-thread stream cannot be replayed and interleaves callers.
◆ rng()
| Rng & Vkm::Engine::Math::Random::rng |
( |
| ) |
|
Per-thread default generator.
Seeded lazily per thread from a clock sample and a global counter, so streams are distinct. Not inline: no engine header carries a thread_local (docs/guides/implementation.md, Threads).
- Returns
- This thread's generator.
◆ value()
| float Vkm::Engine::Math::Random::value |
( |
| ) |
|
|
inline |
Uniform float in [0, 1), from the per-thread generator.
- Returns
- The draw.
◆ range() [1/2]
| float Vkm::Engine::Math::Random::range |
( |
float | min, |
|
|
float | max ) |
|
inline |
Uniform float in [min, max), from the per-thread generator.
- Parameters
-
| min | Lowest value drawn. |
| max | Upper bound, never drawn. |
- Returns
- The draw.
◆ range() [2/2]
| int Vkm::Engine::Math::Random::range |
( |
int | min, |
|
|
int | max ) |
|
inline |
Uniform integer in [min, max], from the per-thread generator.
- Parameters
-
| min | Lowest value drawn. |
| max | Highest value drawn; not below min. |
- Returns
- The draw.
◆ boolean()
| bool Vkm::Engine::Math::Random::boolean |
( |
| ) |
|
|
inline |
Fair coin flip, from the per-thread generator.
- Returns
- The draw.