OpenTTD Source
20241121-master-g67a0fccfad
|
Structure to encapsulate the pseudo random number generators. More...
#include <random_func.hpp>
Public Member Functions | |
uint32_t | Next () |
Generate the next pseudo random number. More... | |
void | SetSeed (uint32_t seed) |
(Re)set the state of the random number generator. More... | |
uint32_t | Next (uint32_t limit) |
Generate the next pseudo random number scaled to limit, excluding limit itself. More... | |
Data Fields | |
uint32_t | state [2] |
The state of the randomizer. | |
Structure to encapsulate the pseudo random number generators.
Definition at line 27 of file random_func.hpp.
uint32_t Randomizer::Next | ( | ) |
Generate the next pseudo random number.
Definition at line 43 of file random_func.cpp.
References state.
Referenced by GenerateTownName(), and RandomCompanyManagerFaceBits().
|
inline |
Generate the next pseudo random number scaled to limit, excluding limit itself.
limit | Limit of the range to be generated from. |
Definition at line 40 of file random_func.hpp.
References Next(), and ScaleToLimit().
Referenced by Next().
void Randomizer::SetSeed | ( | uint32_t | seed | ) |
(Re)set the state of the random number generator.
seed | the new state |
Definition at line 56 of file random_func.cpp.
References state.
Referenced by _GenerateWorld(), and SetRandomSeed().