> On 07 Oct 2016, at 21:28, Patrick R. Michaud <pmich...@pobox.com> wrote: > > On Fri, Oct 07, 2016 at 12:18:43PM -0700, Aaron Sherman wrote: >> [15:12] <harmil_wk> m: say ((2**80) ..^ (2**81)).pick.base(2) >> [15:12] <+camelia> rakudo-moar 605f27: >> OUTPUT«100011101100100110010000000000000000000000000000000000010101111110101101010011001» >> >> The middle part is always a large number of zeros, but it's my >> understanding that it should be a more uniform and continuous range of >> results. > > Awesome catch! The current implementation of Range.pick() is based on > Range.roll(), which uses nqp::rand_I() to choose a random value from > an integer range. > > I'm guessing nqp::rand_I() is returning a 32-bit number, and so Range.pick/ > Range.roll are actually only returning values from 2**80 to 2**80+2**32-1 .
Digging deeper into the rabbit hole, I wind up at: MVM_bigint_rand in src/math/bigintops.c: and there the mp_rand and mp_mod calls feel suspect to me. But then I’m out of my league, so I hope that someone else will be able to pick up from here. Liz