This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/33815] tr1::uniform_int isn't uniform
- From: "pcarlini at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Oct 2007 11:27:24 -0000
- Subject: [Bug libstdc++/33815] tr1::uniform_int isn't uniform
- References: <bug-33815-8718@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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