Correction to binomial random variable generator Bradley Lucier (28 Feb 2023 17:28 UTC)
Re: Correction to binomial random variable generator Bradley Lucier (28 Feb 2023 19:11 UTC)

Re: Correction to binomial random variable generator Bradley Lucier 28 Feb 2023 19:11 UTC

I see that Shawn Wagner has already incorporated these corrections into
his Racket port of this code here:

https://github.com/shawnw/racket-extra-srfi-libs/blob/13baf3bd751e8a3486e870208783f81dbee262ad/srfi/194.rkt#L526

and here:

https://github.com/shawnw/racket-extra-srfi-libs/blob/13baf3bd751e8a3486e870208783f81dbee262ad/srfi/194.rkt#L553

Brad

On 2/28/23 12:27 PM, Bradley Lucier wrote:
> I may have sent this email from the wrong address the first time.
>
> I just sent a pull request that fixes a problem with the binomial random
> variable generator.
>
> In two places the old code used the stream of random reals generated by
> the default (random-real) procedure instead of the stream specific to
> the value of (current-random-source).
>
> This was an error, in that binomial random variables generated for
> different values of (current-random-source) would have been reusing the
> same default stream of random reals for some purposes.
>
> I suppose this could have been detected by a test, but it would be
> difficult to devise such a test.
>
> Brad