diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2011-03-22 19:31:31 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2011-03-22 19:31:31 +0100 |
commit | 916e3feddbdb95d5e664520d57cfbb4b7865a1eb (patch) | |
tree | 9c4d0ef8fbf57a8d8be4b425bf73de50aaf631ec | |
parent | 92a69aa1d05458473f89e9d072a9d97c108adad9 (diff) |
Generate a new random state for each invocation of MAKE-UUID.
-rw-r--r-- | mulkcms-hunchentoot.lisp | 1 | ||||
-rw-r--r-- | mulkcms.lisp | 23 |
2 files changed, 13 insertions, 11 deletions
diff --git a/mulkcms-hunchentoot.lisp b/mulkcms-hunchentoot.lisp index 90d8d31..9cd4b9c 100644 --- a/mulkcms-hunchentoot.lisp +++ b/mulkcms-hunchentoot.lisp @@ -34,6 +34,7 @@ (setq hunchentoot:*default-content-type* "text/html; charset=utf-8") (setup-handlers) + (setq *random-state* (make-random-state t)) (hunchentoot:start (make-instance 'hunchentoot:acceptor :port *server-port* :address *server-address*))) 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) |