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...
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.
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. :)
* 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.