random-float
Generate a random float
Last updated 2 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install random-float 
SYNC missed versions from official npm registry.

random-float Build Status

Generate a random float

Install

$ npm install random-float

Usage

const randomFloat = require('random-float');

randomFloat(5);
//=> 4.401887938147411

randomFloat(10, 100);
//=> 72.34217455144972

API

randomFloat([maximumValue])

Returns an float from 0 to maximumValue.

randomFloat(minimumValue, maximumValue)

Returns an float from minimumValue to maximumValue.

minimumValue

Type: number Default: 0

Minimum float to return.

maximumValue

Type: number Default: 1

Maximum float to return.

Related

License

MIT © Sindre Sorhus

Current Tags

  • 2.0.0                                ...           latest (2 years ago)

2 Versions

  • 2.0.0                                ...           2 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 1
Last Month 8
Dependencies (0)
None
Dev Dependencies (6)

Copyright 2014 - 2017 © taobao.org |