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)
69 <<
" with seed " << std::hex <<
random_seed_).str() << std::endl;
91 std::istringstream
s(seed_str);
92 if (!(s >> std::hex >> new_seed)) {
94 DBG_RND <<
"Failed to seed a random number generator using seed string '" << seed_str <<
"', it could not be parsed to hex. Seeding with 42.\n";
101 stream << std::setfill(
'0');
102 stream << std::setw(
sizeof(
uint32_t)*2);
110 for(
unsigned int i = 0;
i < call_count; ++
i) {
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...
uint32_t random_seed_
Initial seed for the pool.
uint32_t get_next_random()
Get a new random number.
void discard(const unsigned int call_count)
On my local version of boost::random, I can use mt_.discard to discard a number of rng results...
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.
Definitions for the interface to Wesnoth Markup Language (WML).
std::string get_random_seed_str() const
Variant for storing WML attributes.
bool operator==(const mt_rng &other) const
static lg::log_domain log_random("random")
unsigned int random_calls_
Number of time a random number is generated.
Standard logging facilities (interface).
A config object defines a single node in a WML file, with access to child nodes.
GLsizei const GLcharARB ** string
boost::mt19937 mt_
State for the random pool (boost mersenne twister random generator).