mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-28 17:33:17 +00:00
fix implementation bug in random number generator
Our simple_rng is described in comments (in .cpp file) as coming from a desription in man pages, man rand(3). Here is a link to that page: http://linux.die.net/man/3/rand Our implementation did not match the specification, because the rand_pool_ variable was an unsigned int and not an unsigned long. Since the rand_pool_ should basically be constantly overflowing under normal operation of the rng, it is obvious to me that this would affect the long term random results. It is not at all obvious to me whether significant bias or defect would be introduced... but it would not be surprising either.
This commit is contained in:
parent
7a46832348
commit
0597151f15
@ -56,7 +56,7 @@ private:
|
||||
int random_seed_;
|
||||
|
||||
/** State for the random pool (modulo arithmetic). */
|
||||
unsigned random_pool_;
|
||||
unsigned long random_pool_;
|
||||
|
||||
/** Number of time a random number is generated. */
|
||||
unsigned random_calls_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user