mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
Merge pull request #942 from hellerve/veit/reseed
Call Random.reseed at program start
This commit is contained in:
commit
4e943bd506
@ -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
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user