on dcbe2fc help sign in
elk/libraries/Random.elm
23 lines 644 B history raw
1module Random where
3{-| Since the core of Elm is pure, randomness must be handled via signals.
5# Random Numbers
6@docs range, float
7-}
9import Signal (Signal)
10import Native.Random
12{-| Given a range from low to high and a signal of values, this produces
13a new signal that changes whenever the input signal changes. The new
14values are random number between 'low' and 'high' inclusive.
15-}
16range : Int -> Int -> Signal a -> Signal Int
17range = Native.Random.range
19{-| Produces a new signal that changes whenever the input signal changes.
20The new values are random numbers in [0..1).
21-}
22float : Signal a -> Signal Float
23float = Native.Random.float