Evan Monroig <evan.monroig@...> writes:
> Hi,
>
> I am having a strange problem with using random states and the format
> function.
>
> Basically what I want to do is to be able to regenerate twice the same
> data by using a random state.
>
> When using format with the control-string "~10e", it doesn't work,
> although it works as expected if I use "~a" as control-string.
>
[...]
>
> Oh, and my version of SBCL is 0.9.8 on Linux X86.
To answer myself, I just installed SBCL 0.9.17, which fixed the problem
(see output below).
Evan
* (let ((snapshot-state (make-random-state *random-state*)))
(list (with-output-to-string (out)
(loop for i to 3 do (format out "~10e "(random 1000))))
(let ((*random-state* (make-random-state snapshot-state)))
(with-output-to-string (out)
(loop for i to 3 do (format out "~10e "(random 1000)))))))
(let ((snapshot-state (make-random-state *random-state*)))
(list (with-output-to-string (out)
(loop for i to 3 do (format out "~a "(random 1000))))
(let ((*random-state* (make-random-state snapshot-state)))
(with-output-to-string (out)
(loop for i to 3 do (format out "~a "(random 1000)))))))
(" 2.54e+2 5.04e+2 5.e+2 8.88e+2 "
" 2.54e+2 5.04e+2 5.e+2 8.88e+2 ")
*
("121 988 533 880 " "121 988 533 880 ")
*
|