Skip to content
Snippets Groups Projects
Commit 380759e3 authored by Raymond Toy's avatar Raymond Toy
Browse files

Restore ability to compile in mt19937 rng.

- src/tools/worldbuild.lisp
    - only compile rand-xoroshiro if :random-xoroshiro is a feature
- src/tools/worldload.lisp
    - only load rand-xoroshiro if :random-xoroshiro is a feature
- tests/rng.lisp
    - Add a quick test that the state vector of the *random-state* has
      the correct type.
parent 99eb4311
No related branches found
No related tags found
No related merge requests found
...@@ -127,7 +127,6 @@ ...@@ -127,7 +127,6 @@
'("target:code/rand-xoroshiro")) '("target:code/rand-xoroshiro"))
(t (t
'("target:code/rand"))) '("target:code/rand")))
"target:code/rand-xoroshiro"
"target:code/alieneval" "target:code/alieneval"
"target:code/c-call" "target:code/c-call"
"target:code/sap" "target:code/sap"
......
...@@ -102,7 +102,6 @@ ...@@ -102,7 +102,6 @@
(maybe-byte-load "code:rand-xoroshiro") (maybe-byte-load "code:rand-xoroshiro")
#-(or random-mt19937 random-xoroshiro) #-(or random-mt19937 random-xoroshiro)
(maybe-byte-load "code:rand") (maybe-byte-load "code:rand")
(maybe-byte-load "code:rand-xoroshiro")
(maybe-byte-load "target:pcl/walk") (maybe-byte-load "target:pcl/walk")
(maybe-byte-load "code:fwrappers") (maybe-byte-load "code:fwrappers")
(maybe-byte-load "code:ntrace") (maybe-byte-load "code:ntrace")
......
...@@ -20,6 +20,13 @@ ...@@ -20,6 +20,13 @@
(defvar *test-state*) (defvar *test-state*)
(define-test rng.state
(let ((s (kernel::random-state-state *random-state*)))
#+random-xoroshiro
(assert-true (typep s '(simple-array double-float (2))))
#+random-mt19937
(assert-true (typep s '(simple-array (unsigned-byte 32) (627))))))
#+random-xoroshiro #+random-xoroshiro
(define-test rng.initial-state (define-test rng.initial-state
(setf *test-state* (setf *test-state*
...@@ -56,6 +63,7 @@ ...@@ -56,6 +63,7 @@
(assert-equal value (64-bit-value *test-state*)) (assert-equal value (64-bit-value *test-state*))
(assert-equal state (multiple-value-list (64-bit-rng-state *test-state*)))))) (assert-equal state (multiple-value-list (64-bit-rng-state *test-state*))))))
#+random-xoroshiro
(define-test rng.jump (define-test rng.jump
(setf *test-state* (setf *test-state*
(kernel::make-random-object :state (kernel::init-random-state #x12345678) (kernel::make-random-object :state (kernel::init-random-state #x12345678)
...@@ -68,3 +76,4 @@ ...@@ -68,3 +76,4 @@
(kernel:random-state-jump *test-state*) (kernel:random-state-jump *test-state*)
(assert-equal result (multiple-value-list (assert-equal result (multiple-value-list
(64-bit-rng-state *test-state*))))) (64-bit-rng-state *test-state*)))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment