[Bug libstdc++/33815] tr1::uniform_int isn't uniform

pcarlini at suse dot de gcc-bugzilla@gcc.gnu.org
Sat Oct 20 11:27:00 GMT 2007



------- Comment #12 from pcarlini at suse dot de  2007-10-20 11:27 -------
(In reply to comment #11)

> I just tested this. It does a much better job at obfuscating the bias, which is
> still there (after all you are rescaling linearly). If you rescale a domain of
> size 16 to a range of size 12, some buckets will get 2 and some will get 1.

Of course. What I did is just the naive rescaling, which you can find, for
example, in Numerical Recipes. It assumes, implicitly, that the source range is
much bigger than the target range.

In order to have a fully conforming implementation, we need something which
works for *any* source range and *any* target range. Are you willing to work on
that? Would be mainline-only of course, too large for 4.2.x. In that case you
have also to file a Copyright assignment. Please let me know.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33815



More information about the Gcc-bugs mailing list