It is faster than the JMT? Mersenne Twister implementation, but significantly slower than native random number generators provided by major Common Lisp implementations. For light use this shouldn't be a problem, since it is still very fast.
It should be very stable, since it's based on stable CMUCL code. It has been tested on CMUCL, SBCL, (LispWorks), Allegro CL, GCL, CLISP, and Corman Lisp. MT19937 is in the public domain.
;; Load MT19937 (asdf:oos 'asdf:load-op :mt19937);; Make random numbers with your implementation's random number generator. (random 1234567) (random 42.56) (random 3.1415d0)
;; Make random numbers using MT19937 (mt19937:random 1234567) (mt19937:random 42.56) (mt19937:random 3.1415d0)
;; MT19937 has its own random state (eq *random-state* mt19937:*random-state*) => nil
MT19937 can be downloaded from the asdf-packaging home page, or you can use asdf-install.
Download ASDF package from http://common-lisp.net/project/asdf-packaging/mt19937-latest.tar.gz
Without this fix, code calling mt19937:random with a constant argument probably won't compile at all (it would not on ACL 8.0) for lack of a make-load-form method for random-state's. If one is added so that it compiles, it will behave differently than expected: calls using constant arguments with no state argument will fail to use the dynamic value of *random-state* at the time of the call.
The macro definition should read
(define-compiler-macro random (&whole form arg &optional (state '*random-state*)with single quote added in front of *random-state*.
Or it might be safest to delete this macro entirely.
Another weakness is that it is very unclear how to contact a maintainer of the code to correct a bug like this, short of modifying this page!
This page is linked from: Mersenne Twister
CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively