Re: Random generator

Bernd Beuster <[email protected]> Sat, 15 Sep 2007 16:55:07 +0200
Newsgroups gmane.lisp.openmcl.bugs
Message-ID <[email protected]>
A simple test for the choosen random implementation: the run length  
should be 2^31-2.


(defun random-run-length ( &optional (print t))
   "Should be 2^31-2)"
   (declare (optimize speed))
   (loop with start fixnum = (random most-positive-fixnum)
      for current fixnum = (random most-positive-fixnum)
      for i fixnum from 1
      until (= current start)
      finally (return i)
      do (when (and print (zerop (mod i 10000000))) (print i))))


? (random-run-length nil)
134217728
? (log * 2)
27.0

Obviously not.


-- 
Bernd