[Maxima] Discussion about arrays and matrices in Maxima
dlakelan at street-artists.org
Wed May 20 14:13:27 CDT 2009
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.
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
My laptop is a 64 bit AMD processor running between 800 and 1900 MHz
depending on the clock governor (for power saving).
More information about the Maxima