Subject: Discussion about arrays and matrices in Maxima
From: dlakelan
Date: Wed, 20 May 2009 12:13:27 -0700
Richard Fateman wrote:
> I agree entirely with your comments on random. I have written a program
> that does something like this. I found the lisp random number generator
> to be too slow (it is too general) and so I found another method to fill
> a ring-buffer with "enough" pseudo-random numbers for my purpose and
> then I used them one after another for my simulation. Using a looped
> list, I could get the next number by using (pop random_number_loop).
> Of course these were not so random if you used it for long enough.
> RJF
I have found that the random number generator in SBCL when specialized
to produce uniform double floats is pretty darn fast. About the same as
the R random number generator. It is also a mersenne twister algorithm
so it is high quality.
For example "runif(1e6)" takes around .35 seconds on my laptop in R.
(time (dotimes (i 1e6) (random 1.0d0))) takes .258 seconds on my laptop
in SBCL.
My laptop is a 64 bit AMD processor running between 800 and 1900 MHz
depending on the clock governor (for power saving).