New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.pick on a large range needs more entropy #2633
Comments
From @moritz17:26 < TimToady> nom: say (^2**64).pick.fmt('%64b') 17:27 < TimToady> pick from a large range might need to generate more Repeated execution shows that it indeed always ends with many 0's. So, |
From @FROGGScurrent result: <FROGGS> p6: say (^2**64).pick.fmt('%64b') <FROGGS> p6: say (^2**64).pick.fmt('%64b') <FROGGS> p6: say (^2**64).pick.fmt('%64b') |
The RT System itself - Status changed from 'new' to 'open' |
From @diakopter12:52 < diakopter> m: say (^2**64).pick.fmt('%64b') |
From @skidsThis goes all the way down to libtommath. I filed libtom/libtommath#56 upstream. In the meantime xor'ing two mp_rand's with one of them shifted up 32 bits in Moar's rand_I would be one possible workaround. |
From mt1957.2@gmail.comHi, For the dropped leading zeros try .fmt('%064b') Greetings On April 7, 2016 6:53:44 PM "Matthew Wilson via RT"
|
From @skidsOn Thu Apr 07 21:47:26 2016, bri@abrij.org wrote:
There is now a workaround PR#357 to MoarVM for this. Proposed test code: $ perl6 -e 'use Test; my $v = 2; for (1..259) { is ([+|] ((^$v).pick for ^200)), $v - 1, "$v.base(16) .pick hits all bits"; $v +<= 1; }' |
From @FROGGSPR was merged and test got added: Thanks to all involved! |
1 similar comment
From @FROGGSPR was merged and test got added: Thanks to all involved! |
@FROGGS - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#109586 (status was 'resolved')
Searchable as RT109586$
The text was updated successfully, but these errors were encountered: