23 #define DBG_RND LOG_STREAM(debug, log_random)
24 #define LOG_RND LOG_STREAM(info, log_random)
25 #define WRN_RND LOG_STREAM(warn, log_random)
26 #define ERR_RND LOG_STREAM(err, log_random)
65 uint32_t result =
mt_();
67 DBG_RND <<
"pulled user random " << result
83 mt_.discard(call_count);
92 std::istringstream
s(seed_str);
93 if (!(
s >> std::hex >> new_seed)) {
95 DBG_RND <<
"Failed to seed a random number generator using seed string '" << seed_str <<
"', it could not be parsed to hex. Seeding with 42.";
101 std::stringstream stream;
102 stream << std::setfill(
'0');
103 stream << std::setw(
sizeof(uint32_t)*2);
Variant for storing WML attributes.
std::string str(const std::string &fallback="") const
A config object defines a single node in a WML file, with access to child nodes.
std::string get_random_seed_str() const
std::mt19937 mt_
State for the random pool (mersenne twister random generator).
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...
bool operator==(const mt_rng &other) const
unsigned int random_calls_
Number of time a random number is generated.
uint32_t get_next_random()
Get a new random number.
void seed_random(const std::string &seed, const unsigned int call_count=0)
Same as uint32_t version, but uses a stringstream to convert given hex string.
uint32_t random_seed_
Initial seed for the pool.
Definitions for the interface to Wesnoth Markup Language (WML).
Standard logging facilities (interface).
static lg::log_domain log_random("random")
static map_location::DIRECTION s