From 85ee2ca272f8a9af10cada63b8c9d7f5df9e726f Mon Sep 17 00:00:00 2001 From: Michele Comitini Date: Wed, 10 Oct 2012 00:06:10 +0200 Subject: [PATCH] web2py_uuid 2x speedup --- gluon/utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gluon/utils.py b/gluon/utils.py index 1d1e232c..3b092ac7 100644 --- a/gluon/utils.py +++ b/gluon/utils.py @@ -161,8 +161,7 @@ def web2py_uuid(ctokens=UNPACKED_CTOKENS): It works like uuid.uuid4 except that tries to use os.urandom() if possible and it XORs the output with the tokens uniquely associated with this machine. """ - rand_longs = struct.unpack('=QQ', string.join( - (chr(random.randrange(256)) for i in xrange(16)),'')) + rand_longs = (random.getrandbits(64),random.getrandbits(64)) if HAVE_URANDOM: urand_longs = struct.unpack('=QQ', fast_urandom16()) byte_s = struct.pack('=QQ',