Liking cljdoc? Tell your friends :D

stevetrip.rng.core

Pure, serialisable randomness. The rng is plain data you can keep in application state, log, or send over the wire.

Two forms: {:seed s :n counter} each value is a function of seed and counter (splitmix64), so the same seed and call sequence always replay identically. {:queue [6 1 4]} scripted dice for tests. roll-die pops the head and throws when empty. shuffle leaves the collection unchanged and does not consume the queue, so tests set deck order directly.

Every function returns the new rng alongside its result. Nothing is mutated.

Pure, serialisable randomness. The rng is plain data you can keep in application state, log, or send over the wire.

Two forms:
  {:seed s :n counter}  each value is a function of seed and counter (splitmix64),
                        so the same seed and call sequence always replay identically.
  {:queue [6 1 4]}      scripted dice for tests. `roll-die` pops the head and throws
                        when empty. `shuffle` leaves the collection unchanged and does
                        not consume the queue, so tests set deck order directly.

Every function returns the new rng alongside its result. Nothing is mutated.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close