From: ·········@yahoo.com
Subject: random numbers
Date: 
Message-ID: <6ftv0i$9mt$1@nnrp1.dejanews.com>
Random numbers are not behaving as I expect when I "freeze the state".� I
would expect that the second sequence and the second half of the first
sequence would have the same numbers.


(defun test-random ()
�� (print (loop for i from 1 to 10 collecting
����������� (progn
������������� (if (= i 5)
���������������� (setq rs (make-random-state))) ;; obtain a copy of random
state
������������� (random 10))))
�� (print (loop for i from 1 to 5 collecting
����������� (random 10 rs)))������������������� ;; use this state in future
calculation.
�� NIL) ; to avoid unpleasant output. by  convention print procedures return
NIL in my code

Am I misunderstanding something, or is this a peculiarity of my
implementation?  (Admittedly I could get more implementations and try this
before posting, so please forgive my laziness this time :-)

TEST-RANDOM
> (test-random)
(4 8 3 1 4 7 8 3 7 4)
(8 3 3 2 0)�� ;; why not (7 8 3 7 4)?
NIL
> (test-random)
(0 6 2 9 4 2 3 8 9 3)
(8 3 3 2 0)  ;; why not (2 3 8 9 3)?
NIL
> (test-random)
(4 6 8 2 9 0 8 4 4 4)
(8 3 3 2 0)
NIL
>
-----------
Michael Tuchman
Associate Programmer
One Room Systems
(919) 405-2575

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading
From: Thomas A. Russ
Subject: Re: random numbers
Date: 
Message-ID: <ymik9981a4p.fsf@sevak.isi.edu>
·········@yahoo.com writes:

> 
> Random numbers are not behaving as I expect when I "freeze the state".� I
> would expect that the second sequence and the second half of the first
> sequence would have the same numbers.
>
>
> Am I misunderstanding something, or is this a peculiarity of my
> implementation?  (Admittedly I could get more implementations and try this
> before posting, so please forgive my laziness this time :-)

Hmmm.  Your function seems to work as you would expect in Franz ACL 4.3 (Unix).


-- 
Thomas A. Russ,  USC/Information Sciences Institute          ···@isi.edu