From: David Benbennick (dbenbenn_at_[hidden])
Date: 2006-03-15 09:50:59
Class uniform_int from <boost/random/uniform_int.hpp> is supposed to
provide a uniform random integer distribution on a range [min, max].
(See .) It doesn't do that.
I've attached a demonstration program, random.cc. The program asks
uniform_int for integers in the range [0, 780903144], then sorts those
integers into 20 equal buckets. If the random integers were uniformly
distributed, the buckets would all get about the same number of
elements. Instead, the last 5 buckets only get 2/3 as many numbers.
To put it another way, in this specific case, uniform_int
significantly under-represents the top 1/4 of its range.
I've attached a patch to uniform_int.hpp that fixes the problem.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk