From: bruce
Subject: Clisp randomness
Date: 
Message-ID: <Ry2x8.45194$QC1.3176908@bgtnsc04-news.ops.worldnet.att.net>
I'm trying to write a card-playing game using Clisp, and am running
into the problem of not getting a very "random" number from the
RANDOM function.  It's producing the same two hands on every start
in a fresh Clisp, thus the game tends to play much the same way each
time it's run.  How can I either find something random to set to
*random-state*, or else find some other function to fill this gap?

Any enlightenment would be helpful, as I'm still firmly in the newbie
stages...

Thanks,
Bruce H. Nagel
········@innocent.com

From: Gabe Garza
Subject: Re: Clisp randomness
Date: 
Message-ID: <pu0r1a4x.fsf@kynopolis.org>
········@Bast.debian.org (bruce) writes:

> I'm trying to write a card-playing game using Clisp, and am running
> into the problem of not getting a very "random" number from the
> RANDOM function.  It's producing the same two hands on every start
> in a fresh Clisp, thus the game tends to play much the same way each
> time it's run.  How can I either find something random to set to
> *random-state*, or else find some other function to fill this gap?
> 
> Any enlightenment would be helpful, as I'm still firmly in the newbie
> stages...

Enlightenment lies within the Common Lisp HyperSpec, or CLHS as it's
commonly abbreviated (are you using CLisp from within Emacs via ilisp?
If so, take a look at one of the HyperSpec packages that will allow
you to look up symbols...)

The entry for MAKE-RANDOM-STATE reads:

HS> Creates a fresh object of type random-state suitable for use as the
HS> value of *random-state*.

HS> If state is a random state object, the new-state is  a copy[5] of that
HS> object. If state is nil,  the new-state is  a  copy[5] of the  current
HS> random state.  If state is t,  the new-state is   a fresh random state
HS> object that has been randomly initialized by some means.

Thus, something like

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

is what you need...

Gabe Garza
From: bruce
Subject: Re: Clisp randomness
Date: 
Message-ID: <QS2x8.45270$QC1.3185242@bgtnsc04-news.ops.worldnet.att.net>
In article <············@kynopolis.org>, Gabe Garza wrote:
 
>> Any enlightenment would be helpful, as I'm still firmly in the newbie
>> stages...

>Enlightenment lies within the Common Lisp HyperSpec, or CLHS as it's
>commonly abbreviated (are you using CLisp from within Emacs via ilisp?
>If so, take a look at one of the HyperSpec packages that will allow
>you to look up symbols...)

Perhaps I lost patience in contemplating the koan; I was at least looking
in the right place.  I was simply not applying the proper syntax.

Thank you for saving my forehead from impacting a wall; my walls are old
and have brick underneat the plaster. :)

Bruce H. Nagel
········@innocent.com
From: Erik Naggum
Subject: Re: Clisp randomness
Date: 
Message-ID: <3228516700654574@naggum.net>
* ········@Bast.debian.org (bruce)
| I'm trying to write a card-playing game using Clisp, and am running into
| the problem of not getting a very "random" number from the RANDOM
| function.  It's producing the same two hands on every start in a fresh
| Clisp, thus the game tends to play much the same way each time it's run.
| How can I either find something random to set to *random-state*, or else
| find some other function to fill this gap?

  See the entry for the function random in the standard and follow the
  links to the variable *random-state* and the function make-random-state.

///
-- 
  In a fight against something, the fight has value, victory has none.
  In a fight for something, the fight is a loss, victory merely relief.

  Post with compassion: http://home.chello.no/~xyzzy/kitten.jpg