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
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -127,7 +127,6 @@
	     '("target:code/rand-xoroshiro"))
	    (t
	     '("target:code/rand")))
    "target:code/rand-xoroshiro"
    "target:code/alieneval"
    "target:code/c-call"
    "target:code/sap"
+0 −1
Original line number Diff line number Diff line
@@ -102,7 +102,6 @@
(maybe-byte-load "code:rand-xoroshiro")
#-(or random-mt19937 random-xoroshiro)
(maybe-byte-load "code:rand")
(maybe-byte-load "code:rand-xoroshiro")
(maybe-byte-load "target:pcl/walk")
(maybe-byte-load "code:fwrappers")
(maybe-byte-load "code:ntrace")
+9 −0
Original line number Diff line number Diff line
@@ -20,6 +20,13 @@

(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
(define-test rng.initial-state
  (setf *test-state*
@@ -56,6 +63,7 @@
      (assert-equal value (64-bit-value *test-state*))
      (assert-equal state (multiple-value-list (64-bit-rng-state *test-state*))))))

#+random-xoroshiro
(define-test rng.jump
  (setf *test-state*
	(kernel::make-random-object :state (kernel::init-random-state #x12345678)
@@ -68,3 +76,4 @@
    (kernel:random-state-jump *test-state*)
    (assert-equal result (multiple-value-list
			  (64-bit-rng-state *test-state*)))))