From 58f107b1c475acf59797b016f0c86ae71ed0847b Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Thu, 28 Dec 2017 12:26:31 -0800
Subject: [PATCH] Print random state in hex

Add comment for %random-double-float to use xoroshiro-gen directly
instead of random-chunk twice.  A minor micro optimization.
---
 src/code/rand-xoroshiro.lisp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/code/rand-xoroshiro.lisp b/src/code/rand-xoroshiro.lisp
index be9f0cb5a..45d8756d7 100644
--- a/src/code/rand-xoroshiro.lisp
+++ b/src/code/rand-xoroshiro.lisp
@@ -155,10 +155,12 @@
 		     (double-float-bits x)
 		   (logior (ash (ldb (byte 32 0) hi) 32)
 			   lo))))
-	  (prin1 (make-array 2 :element-type '(unsigned-byte 64)
+	  (write (make-array 2 :element-type '(unsigned-byte 64)
 			     :initial-contents (list (c (aref state 0))
 						     (c (aref state 1))))
-		 stream)))
+		 :stream stream
+		 :base 16
+		 :radix t)))
       (write-char #\space stream)
       (pprint-newline :linear stream)
 
@@ -387,6 +389,9 @@
 (defun %random-double-float (arg state)
   (declare (type (double-float (0d0)) arg)
 	   (type random-state state))
+  ;; xoroshiro-gen produces 64-bit values.  Should we use that
+  ;; directly to get the random bits instead of two calls to
+  ;; RANDOM-CHUNK?
   (* arg
      (- (lisp::make-double-float
 	 (dpb (ash (random-chunk state)
-- 
GitLab