[Q]:Generate Unique ID's

Jason Creighton androflux at REMOVETOREPLYsofthome.net
Sat May 24 13:34:59 EDT 2003


On 24 May 2003 04:17:02 -0700
Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:

> marcus at infa.abo.fi (Marcus Alanen) writes:
> > So, just import the file and successively call getUniqueID() to
> > generate UUIDs.
> > 
> > import random
> > import time
> > import os
> 
> Under Linux, I think it's much better to just open /dev/urandom and
> read some random bytes from it.

Well, depends on the "quality" of randomness you need. From
Documentation/devices.txt: (In the Linux kernel source tree)

1 char Memory devices
...
8 = /dev/random      Nondeterministic random number gen.
9 = /dev/urandom     Faster, less secure random number gen.

See the comments in drivers/char/random.c

Jason Creighton




More information about the Python-list mailing list