#include <simple_rng.hpp>
Public Member Functions | |
| simple_rng () | |
| simple_rng (const config &cfg) | |
| int | get_next_random () |
| Get a new random number. | |
| void | seed_random (const unsigned call_count=0) |
| Seeds the random pool. | |
| void | seed_random (const int seed, const unsigned call_count=0) |
| Seeds the random pool. | |
| void | rotate_random () |
| Resets the random to the 0 calls and the seed to the random this way we stay in the same sequence but don't have a lot calls. | |
| int | get_random_seed () const |
| int | get_random_calls () const |
Private Member Functions | |
| void | random_next () |
| Sets the next random number in the pool. | |
Private Attributes | |
| int | random_seed_ |
| Initial seed for the pool. | |
| unsigned | random_pool_ |
| State for the random pool (modulo arithmetic). | |
| unsigned | random_calls_ |
| Number of time a random number is generated. | |
Definition at line 25 of file simple_rng.hpp.
| rand_rng::simple_rng::simple_rng | ( | ) |
Definition at line 244 of file random.cpp.
| rand_rng::simple_rng::simple_rng | ( | const config & | cfg | ) |
Definition at line 251 of file random.cpp.
| int rand_rng::simple_rng::get_next_random | ( | ) |
Get a new random number.
Definition at line 258 of file random.cpp.
References DBG_RND, random_calls_, random_next(), random_pool_, and random_seed_.
Referenced by generate_gender(), unit::generate_traits(), rand_rng::rng::get_random_private(), markov_generate_name(), unstore_unit_advance_choice::random_choice(), and WML_HANDLER_FUNCTION().


| int rand_rng::simple_rng::get_random_calls | ( | ) | const [inline] |
Definition at line 63 of file simple_rng.hpp.
References random_calls_.
Referenced by game_state::write_config(), and game_state::write_snapshot().

| int rand_rng::simple_rng::get_random_seed | ( | ) | const [inline] |
Definition at line 62 of file simple_rng.hpp.
References random_seed_.
Referenced by mp::connect::load_game(), game_state::write_config(), and game_state::write_snapshot().

| void rand_rng::simple_rng::random_next | ( | ) | [private] |
Sets the next random number in the pool.
Definition at line 292 of file random.cpp.
References random_pool_.
Referenced by get_next_random(), and seed_random().

| void rand_rng::simple_rng::rotate_random | ( | ) |
Resets the random to the 0 calls and the seed to the random this way we stay in the same sequence but don't have a lot calls.
Used when moving to the next scenario.
Definition at line 274 of file random.cpp.
References random_calls_, random_pool_, and random_seed_.
Referenced by play_game().

| void rand_rng::simple_rng::seed_random | ( | const int | seed, | |
| const unsigned | call_count = 0 | |||
| ) |
Seeds the random pool.
| seed | The initial value for the random engine. | |
| call_count | Upon loading we need to restore the state at saving so set the number of times a random number is generated for replays the orginal value is required. |
Definition at line 280 of file random.cpp.
References DBG_RND, random_calls_, random_next(), random_pool_, and random_seed_.

| void rand_rng::simple_rng::seed_random | ( | const unsigned | call_count = 0 |
) |
Seeds the random pool.
| call_count | Upon loading we need to restore the state at saving so set the number of times a random number is generated for replays the orginal value is required. |
Definition at line 269 of file random.cpp.
References random_seed_.
Referenced by game_state::game_state(), savegame::loadgame::set_gamestate(), and rand_rng::rng::set_seed().

unsigned rand_rng::simple_rng::random_calls_ [private] |
Number of time a random number is generated.
Definition at line 73 of file simple_rng.hpp.
Referenced by get_next_random(), get_random_calls(), rotate_random(), and seed_random().
unsigned rand_rng::simple_rng::random_pool_ [private] |
State for the random pool (modulo arithmetic).
Definition at line 70 of file simple_rng.hpp.
Referenced by get_next_random(), random_next(), rotate_random(), and seed_random().
int rand_rng::simple_rng::random_seed_ [private] |
Initial seed for the pool.
Definition at line 67 of file simple_rng.hpp.
Referenced by get_next_random(), get_random_seed(), rotate_random(), and seed_random().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:25:28 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |