Get updates via , Github, or RSS | About

Episode 2: Random Numbers Apr 4, 2016

Getting random numbers in Elm requires basing your initial seed on the current time. The simplest way to get the current time in your app is to use a port that is initialized when the app starts.

Samples

Main module
port currentTime : Int
index.html
<script>
Elm.embed(Elm.Core, div, { currentTime: new Date().getTime() });
</script>