[Git][cmucl/cmucl][rtoy-xoro-default] Print random state in hex
Raymond Toy
rtoy at common-lisp.net
Thu Dec 28 20:26:30 UTC 2017
Raymond Toy pushed to branch rtoy-xoro-default at cmucl / cmucl
Commits:
58f107b1 by Raymond Toy at 2017-12-28T12:26:31-08:00
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.
- - - - -
1 changed file:
- src/code/rand-xoroshiro.lisp
Changes:
=====================================
src/code/rand-xoroshiro.lisp
=====================================
--- 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)
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/commit/58f107b1c475acf59797b016f0c86ae71ed0847b
---
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/commit/58f107b1c475acf59797b016f0c86ae71ed0847b
You're receiving this email because of your account on gitlab.common-lisp.net.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20171228/01f7fb42/attachment-0001.html>
More information about the cmucl-cvs
mailing list