[Issue 6023] std.random.uniform and std.bigint.BigInt compilation error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 30 04:41:09 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=6023


Joseph Rushton Wakeling <joseph.wakeling at webdrake.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joseph.wakeling at webdrake.ne
                   |                            |t


--- Comment #7 from Joseph Rushton Wakeling <joseph.wakeling at webdrake.net> 2013-08-30 04:41:06 PDT ---
(In reply to comment #0)
> uniform function from standard library doesn't work correctly with standard
> BigInt. There are no indications anywhere that it shouldn't work, so I think it is a bug.

Typical existing RNGs may be expected to have an underlying range of 0 ..
uint.max, with others perhaps extending that to ulong.max.  They inherently
can't cover the range of possible values that a BigInt can be expected to take,
so there's a strong potential for statistical problems (albeit that those
maxima are Very Big Indeed).

It might be possible to do some customization so that BigInts falling within
the appropriate bounds can be used -- probably your best bet would be to
convert to uints, call the integral-type uniform() and convert back -- but in
general generating random BigInts would require a BigInt-dedicated RNG.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list