This module is a workaround for the Random
module not supporting creating Tasks.
Uses NodeJs crypto.randomBytes() to generate a 32bit seed.
Generate a seed than can be used with Random.step
from elm/random.
roll : IO x Int
roll =
seed
|> IO.map
(Random.step (Random.int 1 6)
|> Tuple.first
)
Generate a random value using a Generator.
roll : IO x Int roll = generate (Random.int 1 6)