Boost logo

Boost :

From: Samuel Krempp (krempp_at_[hidden])
Date: 2004-08-23 15:52:13

le Monday 23 August 2004 15:35, krempp_at_[hidden] écrivit :
> Plus, using a rejection scheme would completely avoid any added bias
> (contrary to uniform_smallint in which the added bias can reach 1/32, thus
> unsuitable for high-precision statistics programs)

the bias of uniform_int is definitely a problem.
With current uniform_int using small_int, the observed frequencies on random
numbers in {0..2} based on mt1993b are about as much biased as I expected
(~0.5%) :
frequence [0] : 0.335951
frequence [1] : 0.331972
frequence [2] : 0.332077
These are frequencies over 100e6 iterations, and are signficantly consistent
(at least 3 digits have already converged).

With proposed change, the same test yields :
frequence [0] : 0.333284
frequence [1] : 0.333346
frequence [2] : 0.33337

There is now almost 100 times less bias. (and it will converge to 0 as we
increase the number of iterations)

I attach the patch. I can commit it and the other one I sent about the
overflow bug if there's no objection on those patches.


Boost list run by bdawes at, gregod at, cpdaniel at, john at