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 .

Pm

Reply via email to