
From:  Philippe Michel 
Subject:  [Buggnubg] The dice are (slightly) rigged 
Date:  Tue, 22 Nov 2011 23:11:49 +0100 (CET) 
Useragent:  Alpine 2.00 (BSF 1167 20080823) 
dice = 1 + (int)(6.0 * genrand_int32(&rngctx>mti, rngctx>mt) / (0xFFFFFFFF + 1.0));
that is, the rng provides a random integer between 0 and 2^321 and it is mapped to a value between 1 and 6.
The trouble is that, since 2^32 is not a multiple of 6, a bias is introduced and we get 715827883 aces, deuces, fours and fives for 715827882 threes and sixes...
Some of the other rngs implemented in gnubg have a similar problem.It is certainly unnoticeable in practice from the rolls stream, but it wouldn't hurt to avoid this.
Are there list members who are knowledgeable on rng robustness and could confirm that, if one starts with a "good" rng for integers uniformly distributed between 0 and n and discards any occurence of the top p values, one gets a good rng for the [0, np] interval ?
Intuitively, it is tempting to say : "yes, and it is a condition for the original generator being any good" but I'm afraid it may be a treacherous domain.
[Prev in Thread]  Current Thread  [Next in Thread] 