xor: how come so slow?

MRAB google at mrabarnett.plus.com
Sun Oct 19 10:19:38 EDT 2008


On Oct 19, 7:13 am, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On Sun, 19 Oct 2008 04:38:04 GMT, Tim Roberts <t... at probo.com> declaimed
> the following in comp.lang.python:
>
>
>
> > 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.
>
>         Some decade I'll have to obtain his volumes... But they've never
> shown up in a $60 special offer from a book club (unlike the compact
> editions of the OED) <G>.
>
>         And while XOR may seem significant, just consider die rolls...
>
>         If each "byte" were one die roll, you'd expect a nearly even
> distribution... (for a 6 sided die, 1/6 would have each value). But
> using the sum of two die, your begin to get a bell curve: 2 and 12
> appear 1/36 of the time (each), but 7 occurs 6/36 of the time. Use three
> die, and it gets worse: 3 and 18 occur 1/216, "10.5" occurs much more
> often...
>
That should be one die, two dice, etc. :-)



More information about the Python-list mailing list