develooper Front page | perl.perl6.compiler | Postings from February 2012

[perl #109586] .pick on a large range needs more entropy

From:
Moritz Lenz
Date:
February 1, 2012 08:31
Subject:
[perl #109586] .pick on a large range needs more entropy
Message ID:
rt-3.6.HEAD-14510-1328113910-476.109586-82-0@perl.org
# New Ticket Created by  Moritz Lenz 
# Please include the string:  [perl #109586]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=109586 >


17:26 < TimToady> nom: say (^2**64).pick.fmt('%64b')
17:26 <+p6eval> nom ce5cca:
OUTPUT«1010100001010011111100101101011101010001000000010000000000000000␤»

17:27 < TimToady> pick from a large range might need to generate more
                   entropy than a single standard rand call provides; note
                   the trailing 0's above


Repeated execution shows that it indeed always ends with many 0's. So, 
not random enough. http://xkcd.com/221/ applies :-)



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About