Source of Nothingness - 2007-02-21

* 2007-02-21

擬似乱数生成器 Xorshift RNGs ってのを見つけた。
 http://lucille.atso-net.jp/blog/?p=9
書いてみる
(let ((x 123456789) (y 362436069) (z 521288629) (w 88675123))
  (defun xor128 ()
    (let ((a (logxor x (logand #xFFFFFFFF (ash x 11)))))
      (shiftf x y z w)
      (setq w (logxor (logxor w (ash w -19)) (logxor a (ash a -8)))))))

(dotimes (i 100)
  (format t "~8,'0x~%" (xor128)))

update : 2010-04-28 (Wed) 12:55:48