xor: how come so slow?

Tim Roberts timr at probo.com
Sun Oct 19 00:38:04 EDT 2008


Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:
>
>On Fri, 17 Oct 2008 20:51:37 +1300, Lawrence D'Oliveiro wrote:
>
>> Is piece really meant to be random? If so, your create_random_block
>> function isn't achieving much--xoring random data together isn't going
>> to produce anything more exciting than less random data than you started
>> with.
>
>Hmmm... why do you say that xoring random data with other random data 
>produces less randomness than you started with?
>
>I'm not saying that you're wrong, and certainly it is pointless since 
>you're not going to improve on the randomness of /dev/urandom without a 
>lot of work. But less random? 

For those who got a bit lost here, I'd would point out that Knuth[1] has an
excellent chapter on random numbers that includes a detailed discussion of
this effect.  His net takeaway is that most of the things people do to
increase randomness actually have exactly the opposite effect.
-----
[1] Knuth, Donald.  The Art of Computer Programming, Volume 2,
Seminumerical Algorithms.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list