Practice 3.6
(define (rand-update x)
(modulo (+ (* 214013 x) 2531011) (expt 2 32)))
(define rand
(let ((x 1))
(lambda (n)
(cond ((eq? n 'generate)
(begin (set! x (rand-update x))
x))
((eq? n 'reset)
(lambda (new-value)
(set! x new-value)))
(else
(error "Unexpeccted params--"
n))))))
(rand 'generate)
(rand 'generate)
(rand 'generate)
(rand 'generate)
(rand 'generate)
((rand 'reset) 0)
(rand 'generate)
(rand 'generate)
(rand 'generate)
(rand 'generate)
(rand 'generate)