[slime-devel] random returning the same value

Tobias C. Rittweiler tcr at freebits.de
Sat Dec 6 08:12:10 UTC 2008


Patrick May <pjm at spe.com> writes:

> Hi,
>
> 	I'm using Slime in Aquamacs with CCL.  When I evaluate (random
> 100) repeatedly in CCL started from a shell, I get a randomly
> generated  number between 0 and 99 inclusive.  When I do the same with
> C-x C-e  within Slime, I get the same number every time.  (random 100
> (make- 
> random-state)) gives the same behavior, but (random 100 (make-random-
> state t)) works properly.
>
> 	Is Slime caching something or have I hosed up my environment?

Sorry for the late response.  CCL's swank backend uses threads by
default, and threads inherit values from the global
environment. *RANDOM-STATE* probably becomes thread-local automatically
in CCL, resulting in the behaviour you described.

It should work when you type in the form at the Slime REPL which
evaluates all forms in the same thread.

  -T.





More information about the slime-devel mailing list