The documentation for Elm\'s Random
module states:
A good way to get an unexpected seed is to use the current time. http://package.elm-
If you are using the StartApp then you'll need to use a custom HTML file with
Then to use the startTime as a seed:
startTimeSeed : Seed
startTimeSeed = Random.initialSeed <| round startTime
app =
StartApp.start
{ init = (init startTimeSeed, Effects.none)
, update = update
, view = view
, inputs = []
}
And then in the code you'll be doing something like
init : Seed -> List Int
init seed = fst <| Random.generate intList seed
where, for example:
intList : Random.Generator (List Int)
intList =
Random.list 5 (Random.int 0 100)