From: Evan M. <eva...@gm...> - 2006-10-16 05:13:34
|
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. I reproduced a minimal example below: * (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))))))) (" 2.61e+2 8.66e+2 9.2e+2 2.89e+2 " " 2.61e+2 6.2e+1 8.66e+2 9.2e+2 ") * (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))))))) ("120 754 703 353 " "120 754 703 353 ") * Oh, and my version of SBCL is 0.9.8 on Linux X86. Thanks, Evan |