I was looking to take a random sample from a sequence by zipping it to a random infinite sequence and doing quickselect on the second element of tuples, but I hit the problem that a sequence initialized with random integers doesn't stay with the same value from the first time it was evaluated. So for example the following code outputs 5 different lines.
let ran=new System.Random(10001100)
let MySeq=Seq.init 10 (fun i->ran.Next())
for time in 0..4 do (for element in MySeq do printf "%s " (element.ToString())
do printf "\n")
Is there any way to initialize a sequence with random values so that the values remain constant once evaluated?
Aucun commentaire:
Enregistrer un commentaire