summaryrefslogtreecommitdiff
path: root/mulkcms.lisp
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2011-03-22 19:31:31 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2011-03-22 19:31:31 +0100
commit916e3feddbdb95d5e664520d57cfbb4b7865a1eb (patch)
tree9c4d0ef8fbf57a8d8be4b425bf73de50aaf631ec /mulkcms.lisp
parent92a69aa1d05458473f89e9d072a9d97c108adad9 (diff)
Generate a new random state for each invocation of MAKE-UUID.
Diffstat (limited to 'mulkcms.lisp')
-rw-r--r--mulkcms.lisp23
1 files changed, 12 insertions, 11 deletions
diff --git a/mulkcms.lisp b/mulkcms.lisp
index e1a24dc..3a13215 100644
--- a/mulkcms.lisp
+++ b/mulkcms.lisp
@@ -25,17 +25,18 @@
(defun make-uuid ()
;; Taken from Mulkblog.
"Generate a version 4 UUID according to RFC 4122, section 4.4."
- (format nil "~(~8,'0x-~4,'0x-~4,'0x-~2,'0x~2,'0x-~12,'0x~)"
- (random #x100000000) ;time_low
- (random #x10000) ;time_mid
- (logior #b0100000000000000
- (logand #b0000111111111111
- (random #x10000))) ;time_hi_and_version
- (logior #b10000000
- (logand #b00111111
- (random #x100))) ;clock_seq_hi_and_reserved
- (random #x100) ;clock_seq_low
- (random #x1000000000000)))
+ (let ((*random-state* (make-random-state t)))
+ (format nil "~(~8,'0x-~4,'0x-~4,'0x-~2,'0x~2,'0x-~12,'0x~)"
+ (random #x100000000) ;time_low
+ (random #x10000) ;time_mid
+ (logior #b0100000000000000
+ (logand #b0000111111111111
+ (random #x10000))) ;time_hi_and_version
+ (logior #b10000000
+ (logand #b00111111
+ (random #x100))) ;clock_seq_hi_and_reserved
+ (random #x100) ;clock_seq_low
+ (random #x1000000000000))))
(defmacro dynamic-lambda ((&rest dynvars) lambda-list &body body)