Re: Okay, more distributions will be fine after all
Bradley Lucier 12 Jul 2020 18:03 UTC
On 7/12/20 11:52 AM, John Cowan wrote:
> Still trying to understand what Brad wants.
What I want is
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Carefully step through the independent substreams of the i'th
;;; stream of random numbers.
(define (random-source-generator i)
(let ((j 0))
(lambda ()
(let ((new-source (make-random-source))) ;; deterministic
(random-source-pseudo-randomize! new-source i j)
(set! j (+ j 1))
new-source))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
The following definitions from Arvydas's fork of SRFI 194 are OK with me:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Parameters & syntax
;;
(define current-random-source (make-parameter default-random-source))
(define-syntax with-random-source
(syntax-rules ()
((_ random-source proc arg ...)
(begin
(unless (random-source? random-source)
(error "expected random source"))
(parameterize ((current-random-source random-source))
(proc arg ...))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;