;;; random stuff (let* ((seed0 10013) (seed seed0) (multiplier 16807.0d0) (modulus 2147483647.0d0)) (defun reset-seed () (setf seed seed0)) (defun randf (n) (* n (- 1.0d0 (park-miller-randomizer)))) (defun randi (n) (floor (* n (/ (randf 1000.0) 1000)))) (defun park-miller-randomizer () "cycle= 2,147,483,646 numbers" (setf seed (mod (* multiplier seed) modulus)) (/ seed modulus)) ) (deftest !rands () (reset-seed) (dotimes (i 11) (randf 100)) (test (randf 100) 8.386648357094572d0) (reset-seed) (test (randf 100) 92.16345646053713d0))