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