Skip to content

Instantly share code, notes, and snippets.

@Risto-Stevcev
Created March 23, 2016 22:33
Show Gist options
  • Save Risto-Stevcev/e691e4927e98671dba49 to your computer and use it in GitHub Desktop.
Save Risto-Stevcev/e691e4927e98671dba49 to your computer and use it in GitHub Desktop.
Point-free rngN
// Just made it as an exercise for point-free ramda
> const R = require('ramda')
> const pfRng = R.compose(R.partial(R.times(R.compose(Math.floor, R.converge(R.multiply, [R.identity, Math.random])))), R.of)
> pfRng(20)()
[ 0, 0, 1, 1, 0, 2, 2, 2, 6, 2, 6, 10, 9, 6, 13, 6, 2, 5, 14, 6 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment