4Elm.Random = function() {
7 /** inRange : Int -> Int -> Signal Int
8 Given a range from low to high, this produces a random number
9 between 'low' and 'high' inclusive. The value in the signal does
10 not change after the page has loaded.
12 var inRange = function(min) { return function(max) {
13 return Elm.Signal.constant(Math.floor(Math.random() * (max-min+1)) + min);
17 /** randomize : Int -> Int -> Signal a -> Signal Int
18 Given a range from low to high and a signal of values, this produces
19 a new signal that changes whenever the input signal changes. The new
20 values are random number between 'low' and 'high' inclusive.
22 var randomize = function(min) { return function(max) { return function(signal) {
23 function f(x) { return Math.floor(Math.random() * (max-min+1)) + min; }
24 return Elm.Signal.lift(f)(signal);
28 return { inRange:inRange, randomize:randomize };
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list