[NCLUG] Python v.s. Ruby, and PRNGs
Sean Reifschneider
jafo at tummy.com
Wed Apr 9 23:15:52 MDT 2008
Stephen Warren wrote:
> So, I wrote a quick script that basically does:
So, I'm interested in how well the Linux /dev/random does. Of course, it
depends on having a good source of entropy. I'm running a small script to
pull out 100,000 dual dice rolls from a few different machines that I
suspect might have a reasonable source of randomness. I'll post the
results somewhere when they complete, it looks like it's going to take a
while.
The script I'm using is:
#!/bin/sh
for (( i=0; i < $1; i++ )) do
D1=`od --read-bytes=1 -t u1 /dev/random | head -1 | sed 's/.* //'`
D1=$[(D1%6)+1]
D2=`od --read-bytes=1 -t u1 /dev/random | head -1 | sed 's/.* //'`
D2=$[(D2%6)+1]
echo $D1 $D2 $[D1+D2]
done
Probably would be worth trying with /dev/urandom as well.
If I hand some of this data off to you, Stephen, can you plug them into
your script?
Thanks,
Sean
--
Sean Reifschneider, Member of Technical Staff <jafo at tummy.com>
tummy.com, ltd. - Linux Consulting since 1995: Ask me about High Availability
More information about the NCLUG
mailing list