Created
November 9, 2015 19:56
-
-
Save zhangchiqing/6b5977e5260c285fbd45 to your computer and use it in GitHub Desktop.
Random Int in Pointfree style
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var R = require('ramda'); | |
// Int -> Int | |
var nextRandomInt = R.pipe(R.converge(R.multiply, [R.identity, Math.random]), Math.floor); | |
// nextRandomInt(2) | |
// => 1 | |
// nextRandomInt(2) | |
// => 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment