Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Clisp randomness
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
bruce  
View profile  
 More options Apr 22 2002, 9:13 pm
Newsgroups: comp.lang.lisp
From: losth...@Bast.debian.org (bruce)
Date: Tue, 23 Apr 2002 01:13:21 GMT
Local: Mon, Apr 22 2002 9:13 pm
Subject: Clisp randomness
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
losth...@innocent.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gabe Garza  
View profile  
 More options Apr 22 2002, 9:22 pm
Newsgroups: comp.lang.lisp
From: Gabe Garza <g_ga...@ix.netcom.com>
Date: Tue, 23 Apr 2002 01:22:08 GMT
Local: Mon, Apr 22 2002 9:22 pm
Subject: Re: Clisp randomness

losth...@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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
bruce  
View profile  
 More options Apr 22 2002, 9:34 pm
Newsgroups: comp.lang.lisp
From: losth...@Bast.debian.org (bruce)
Date: Tue, 23 Apr 2002 01:34:40 GMT
Local: Mon, Apr 22 2002 9:34 pm
Subject: Re: Clisp randomness

In article <pu0r1a4x....@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
losth...@innocent.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Erik Naggum  
View profile  
 More options Apr 22 2002, 10:11 pm
Newsgroups: comp.lang.lisp
From: Erik Naggum <e...@naggum.net>
Date: Tue, 23 Apr 2002 02:11:41 GMT
Local: Mon, Apr 22 2002 10:11 pm
Subject: Re: Clisp randomness
* losth...@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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »