The following, which will work on other lisps will fail on CMUCL and SBCL
(let* ((state (make-mt-random-state))
(state1 (make-mt-random-state state))
(state2 (make-mt-random-state state))
foo bar)
(let ((*mt-random-state* state1))
(setf foo
(iter (for i from 0 below 10000)
(collecting (random-uniform)))))
(let ((*mt-random-state* state2))
(setf bar
(iter (for i from 0 below 10000)
(collecting (random-uniform)))))
(equalp foo bar))
For other lisps, all we need to do is control *MT-RANDOM-STATE*, but this optimization changes the semantics of RANDOM-UNIFORM so that it requires trapping *RANDOM-STATE*.
The cost to correctness of this optimization seems higher than the benefit to efficiency. I suggest you kill it.
Because of this:
The following, which will work on other lisps will fail on CMUCL and SBCL
For other lisps, all we need to do is control
*MT-RANDOM-STATE*
, but this optimization changes the semantics ofRANDOM-UNIFORM
so that it requires trapping*RANDOM-STATE*
.The cost to correctness of this optimization seems higher than the benefit to efficiency. I suggest you kill it.