[Newbies] Re: What's wrong with this statement?
Randal L. Schwartz
merlyn at stonehenge.com
Mon Aug 4 04:17:48 UTC 2008
>>>>> "Cerebus" == Cerebus <cerebus2 at gmail.com> writes:
Cerebus> Attached is a new Integer>atRandom I'm playing with. I break the
Cerebus> integer into a ByteArray and call #atRandom for every byte, using 255
Cerebus> as the bounding value for all but the first byte. The bounding value
Cerebus> for the first byte is itself minus 1. Concatenated together we get a
Cerebus> byte array representing a random value less than the bounding value.
You're going to get a correlation at some point. You're merely spreading the
same amount of entropy around in different places. It's not "more random".
Look at it this way. The cycle will repeat in 2**53 calls to the random
number generator. By calling it 10 times for each "result", you're using
causing it to loop 10 times as fast. You can't get 10 pounds of entropy out
of a 5 pound sack.
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
More information about the Beginners