Truly random numbers

Luka Milkovic Luka.Milkovic at public.srce.hr
Thu Feb 13 11:06:29 EST 2003


On Wed, 12 Feb 2003 03:08:56 +0100, John La Rooy wrote:

> or more simply (not using os.open() and os.read())
> 
> 
>     import select
> 
>     number_of_groups=10000
>     length_of_group=4
> 
>     dev_random=open("/dev/random")
>     P=select.poll()
>     P.register(dev_random.fileno(),select.POLLIN)
> 
>     groups=[]
> 
>     while len(groups) < number_of_groups:
>         group=""
>         while len(group) < length_of_group:
>             if P.poll(0.1):
>                 group+="%2.2X"%ord(dev_random.read(1))
>         groups.append(group)
>     print groups
> 
> John

Thanks John... I managed to solve the problem.
Thanks everyone else.
I don't really need state-of-the-art entropy because it is going to be
mainly for amateur purposes, so I really don't need my own random number
generator. I also heard it could be done with connecting fire alarm with
your computer, but I am not good with electronics:)
As I said, I don't need such entropy because the users will have to
generate their own pads ( for lazy ones, I decided to put generator, but
not pseudo, because it is really insecure, and generating numbers will
only give lazies the false security ), and as we now, human mind is much
more random than computers.
Thanks again.
Luka




More information about the Python-list mailing list