You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't think anyone is actually using this, but just in case: if you need a common Clojure/ClojureScript API for random number generation, you should use the splittable PRNG implemented for test.check (clojure.test.check.random). I implemented pprng solely to enable double-check, and its deprecation leaves this project without purpose.
portable pseudo-random number generators for Clojure/ClojureScript
NOTE pprng does not use cryptographically-secure random number generators,
either on Clojure/JVM or ClojureScript/JS. DO NOT use this library to
help implement or inform any cryptographically-sensitive algorithm.
user=> (require '[cemerick.pprng :as rng])
nil;; get a new RNG, optionally providing a seed
user=> (defrng (rng/rng))
#'user/rng
;; obtain values from it...
user=> (rng/int rng)
-1170105035
user=> (rng/int rng 1000)
267
user=> (rng/boolean rng)
false
user=> (rng/double rng)
0.6832234717598454;; obtain the seed that was used to create it originally, if necessary
user=> (rng/seed rng)
1372270869019
Need Help?
Ping cemerick on freenode irc or
twitter if you have questions or would
like to contribute patches.