Subject: RE: [clisp-list] Random function

From: "Justice, Randy -CONT" <[email-masked]>
Date: Tue, 14 Nov 2000 16:09:33 -0600

Hi.. 
   I'm new to lisp. I have looked at the reference.  
   I did not get very much out of the reference manual. 

   Let me give you an example. I start lisp. 
   (random 1000) => 824
   (random 1000) => 10
   (random 1000) => 250
   (random 1000) => 267

I restart the machine and restart lisp.
   (random 1000) => 824
   (random 1000) => 10
   (random 1000) => 250
   (random 1000) => 267

I get the same results.  
I have tried "stuff" with "make-random-state" function. 

Thanks for any help...

Randy 

-----Original Message-----
From: Sam Steingold [mailto:[email-masked]]
Sent: Tuesday, November 14, 2000 4:17 PM
To: Justice, Randy -CONT
Cc: [email-masked]
Subject: Re: [clisp-list] Random function

> * In message
<[email-masked]>
> * On the subject of "[clisp-list] Random function"
> * Sent on Tue, 14 Nov 2000 12:51:25 -0600
> * Honorable "Justice, Randy -CONT" <[email-masked]> writes:
>
>    I am using the random function.  Very strangely, it looks like the
> same sets of numbers keep appearing.
> 
>    In other languages, I have seen the same results. Other languages
> has a function to "seed" the random function.
> 
>    Does CLISP have a function to "seed" random function?

Please see 
http://www.lisp.org/HyperSpec/Body/fun_random.html
http://www.lisp.org/HyperSpec/Body/fun_make-random-state.html

-- 
Sam Steingold (http://www.podval.org/~sds)
Support Israel's right to defend herself!
<http://www.i-charity.com/go/israel>
The only guy who got all his work done by Friday was Robinson Crusoe.

---

From: Bruno Haible <[email-masked]>
Date: Wed, 15 Nov 2000 14:59:44 +0100 (CET)

> I restart the machine and restart lisp.

Ah, I see what you mean. The problem is that the *random-state* value
is contained in the lisp image, and each time you start the same lisp
image, the *random-state* value is the same.

You might want to add

    (setq *random-state* (make-random-state t))

to your $HOME/.clisprc file.

Bruno