2014-11-01から1ヶ月間の記事一覧

scheme(gauche)でxorshift乱数

SICP 3.1.2節のために。 (define (shift-32bit n count) (logand (ash n count) #xFFFFFFFF)) (define (make-xorshift-rand x y z w) (lambda() (let ((t (logxor x (shift-32bit x 11)))) (begin (set! x y) (set! y z) (set! z w) (set! w (logxor (logxor…