Hi!
I'm using the random-integer function, but it would seem that it always give the same set of results after each execution... I then guessed I had to set the random seed, somehow but I couldn't figure out the way to do it...
I tried something like:
(set! default-random-source (make-random-source)) (random-source-randomize! default-random-source) (pp (random-integer 10)) (pp (random-integer 10)) (pp (random-integer 10))
And tried to run it multiple times and I still get the same answer each time I run this simple program... :(
What should be done to make this random? Shouldn't be that the default-random-source produce different random integers at each program launch??
Thanks!
David
Afficher les réponses par date
On 11-Sep-07, at 6:53 AM, David St-Hilaire wrote:
Hi!
I'm using the random-integer function, but it would seem that it always give the same set of results after each execution... I then guessed I had to set the random seed, somehow but I couldn't figure out the way to do it...
I tried something like:
(set! default-random-source (make-random-source)) (random-source-randomize! default-random-source) (pp (random-integer 10)) (pp (random-integer 10)) (pp (random-integer 10))
Remove the assignment to default-random-source and everything will work as expected.
Marc