![]() |
Ultra 0.9.4
|
Namespaces | |
| namespace | ultra |
Functions | |
| std::size_t | ultra::random::ring (std::size_t base, std::size_t radius, std::size_t n) |
| engine_t & | ultra::random::engine () |
| void | ultra::random::randomize () |
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/
|
nodiscard |
Every thread has its own generator initialised with a different seed.
| void ultra::random::randomize | ( | ) |
Switches the random subsystem to an unpredictable state.
This function "re-bases" the process-wide seed counter so that random engines created after this call are typically seeded unpredictably.
Implementation notes / assumptions:
Each thread owns its own thread-local random engine; therefore, only engines created after this call are affected. Existing engines are left unchanged.
This design allows deterministic and non-deterministic random behaviour to coexist within the same program, depending on when engines are initialised.
|
nodiscard |
Returns a random number in a modular arithmetic system.
| [in] | base | a base number |
| [in] | radius | maximum distance from the base number |
| [in] | n | modulus |