Merge pull request #942 from hellerve/veit/reseed

Call Random.reseed at program start
This commit is contained in:
Erik Svedäng 2020-11-17 22:29:58 +01:00 committed by GitHub
commit 4e943bd506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -26,6 +26,11 @@
(do
(set! s (mod (+ (* s a) c) m))
(/ s m)))
(private _)
(hidden _)
(doc _ "forces reseeding based on the current time at program start")
(def _ (do (seed) 0))
)
(defmodule Int

View File

@ -3,11 +3,6 @@
(use-all Random Test)
(deftest test
(assert-op test
0.658908
(Random.random)
"deterministic randomization works as expected"
Double.approx)
(assert-op test
0.536041
(do (Random.seed-from 33333.0) (Random.random))