updated version, but need to update installation scripts
[cls.git] / tests / rans.lsp
blob3ede26d16b9fa03cedba9b2388a1249fd56cd272
1 (defun get-random-state-values (s)
2 (second (read-from-string (prin1-to-string s) t nil :start 2)))
4 (defun test-random-state (state values)
5 (let ((*random-state* state)
6 (state-max (aref (get-random-state-values *random-state*) 0)))
7 (check #'=
9 (mapcar #'(lambda (v)
10 (random state-max)
11 (- v (aref (get-random-state-values *random-state*) 1)))
12 values))))
14 ; combined congruential
15 (test-random-state '#$(1 #(2147483562 0 12345 67890))
16 '(2026359911 1950599823 315009702 1105313978 871469535
17 1575849876 94472070 728775444 2137747604 430227419))
19 ; superduper
20 (test-random-state '#$(2 #(2147483647 0 0 12345 1 2354))
21 '(274318794 1445882217 174694986 21258797 860839904
22 1611788216 2056178182 1140888495 12651638 485726963))
24 ; combined tausworth
25 (test-random-state '#$(3 #(2147483647 0 12345 67890))
26 '(702677384 51837197 1914342640 434186539 1381102196
27 1693194944 898066022 1288590140 645917234 1416028832))