Created
March 5, 2014 09:57
-
-
Save syou6162/9364393 to your computer and use it in GitHub Desktop.
rand-intなどの関数に無理やり再現性を持たせる(seedを設定する)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [seed (java.util.Random. 1)] | |
(with-redefs [rand (fn [n] (* n (. seed nextDouble)))] | |
(mapv (fn [_] (rand-int 2)) (range 10)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment