CSBiology / FSharpAux

Auxiliary functions and data structures for the F# programming language
MIT License
23 stars 16 forks source link

[BUG] Random number generators in shuffle functions are not random. #11

Closed bvenn closed 4 years ago

bvenn commented 4 years ago

Description

If functions with random number generators (all shuffle functions in Array, JaggedArray, and Array2D) are used in a loop where they are called multiple times within a short time period, they yield the same result due to an identical seed.

Repro steps

for i=0 to 10 do printfn "%A" (Array.shuffleFisherYates [|0 .. 10|])

Solution

Provide the random number generator as parameter and define it outside the loop.

bvenn commented 4 years ago

closed by 3b59903d65c807611eb0503bcb9e0300130ac079