Random and whrandom
Emile van Sebille
emile at fenx.com
Sat Jan 20 22:14:45 EST 2001
Could you post the code? I've heard that said about
Wichman-Hill, but I don't see it in this, eg:
import random
freq = {}
for i in xrange(36000):
d1 = random.randrange(0, 6)
d2 = random.randrange(0, 6)
x = freq.get((d1, d2), 0)
freq[(d1, d2)] = x + 1
results = freq.items()
results.sort()
print '\n'.join(map(str, results))
I ran this several times, and without doing the math on the
results, it certainly appears sufficiently random.
--
Emile van Sebille
emile at fenx.com
-------------------
<bogus at bogus.net> wrote in message
news:3a6a3540.1976549 at news.xo.com...
> The whrandom algorithm may not generate very good random
numbers. I
> created a pair of dice objects and rolled them 10,000
times, there
> seems to be a bias against rolling the same number on both
dice.
>
> M
>
> Marshall A
More information about the Python-list
mailing list