randf
Version:
random float between a range
26 lines (15 loc) • 740 B
Markdown
[](http://github.com/badges/stability-badges)
Returns random float between a range. If no range is specified, 0 (inclusive) to 1 (exclusive) is used. You can also pass a single number to specify a range between 0 and N.
```js
var random = require('randf')
console.log( random() ) // => 0 ... 1
console.log( random(25) ) // => 0 ... 25
console.log( random(-1, 1) ) // => -1 ... 1
```
[](https://nodei.co/npm/randf/)
Returns a new random number within the given range.
MIT, see [LICENSE.md](http://github.com/mattdesl/randf/blob/master/LICENSE.md) for details.