From: Sergey Koveshnikov
Subject: Gaussian distribution
Date: 
Message-ID: <a0uisc$qig$1@DCS.eurocom.od.ua>
Hi, 
The problem I have is as follows:
I try to generate some random numbers whith Gaussian distribution 
(clocc library module rng.lisp)
but all nubbers are equal...

CMU Common Lisp 18c, running on Aldan
Send questions and bug reports to your local CMU CL maintainer,
or to ··········@cons.org. and ·········@cons.org. respectively.
Loaded subsystems:
    Python 1.0, target Intel x86
    CLOS based on PCL version:  September 16 92 PCL (f)
    MATLISP/Pre 2.0
*(dotimes (i 10)
  (let ((rs (make-random-state t)))
    (print (cllib::gen-gaussian-variate rs))))
* ;;;Evaluating dotimes
-1.0371617631304164d0 
-1.0371617631304164d0 
-1.0371617631304164d0 
-1.0371617631304164d0 
-1.0371617631304164d0 
-1.0371617631304164d0 
-1.0371617631304164d0 
-1.0371617631304164d0 
-1.0371617631304164d0 
-1.0371617631304164d0 
NIL
*
 
any comments are welcome.

-- 
Best regards,
Sergey Koveshnikov.

From: Jeff Greif
Subject: Re: Gaussian distribution
Date: 
Message-ID: <C7FY7.73734$WK1.18098995@typhoon.we.rr.com>
Try making the random state outside the loop (before dotimes).  Most
pseudorandom number generators are set up so that given the same state,
they produce the same sequence of numbers.  Normally, you set the state
once (or much more rarely than the number of calls to the generator).

Jeff

"Sergey Koveshnikov" <·······@eurocom.od.ua> wrote in message
·················@DCS.eurocom.od.ua...
>
> Hi,
> The problem I have is as follows:
> I try to generate some random numbers whith Gaussian distribution
> (clocc library module rng.lisp)
> but all nubbers are equal...
>
> CMU Common Lisp 18c, running on Aldan
> Send questions and bug reports to your local CMU CL maintainer,
> or to ··········@cons.org. and ·········@cons.org. respectively.
> Loaded subsystems:
>     Python 1.0, target Intel x86
>     CLOS based on PCL version:  September 16 92 PCL (f)
>     MATLISP/Pre 2.0
> *(dotimes (i 10)
>   (let ((rs (make-random-state t)))
>     (print (cllib::gen-gaussian-variate rs))))
From: Sergey Koveshnikov
Subject: Re: Gaussian distribution
Date: 
Message-ID: <a0v7p6$ogo$1@DCS.eurocom.od.ua>
Thanks for your solution Jeff,
all works correct.

Jeff Greif wrote:

> Try making the random state outside the loop (before dotimes).  Most
> pseudorandom number generators are set up so that given the same state,
> they produce the same sequence of numbers.  Normally, you set the state
> once (or much more rarely than the number of calls to the generator).

-- 
Best regards,
Sergey Koveshnikov.