random-parse
random parse Float or Int
Last updated 2 years ago by tager.wang .
ISC · Original npm · Tarball · package.json
$ cnpm install random-parse 
SYNC missed versions from official npm registry.

random-float Build Status

Generate a random float

Install

$ npm install --save random-parse

Usage

var getRandom = require('random-parse');
var random = new getRandom();

var randomFloat = random.randomFloat;

randomFloat(5);
//=> 4.401887938147411

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

API

randomFloat(max)

Returns an float from 0 to max.

randomFloat(min, max)

Returns an float from min to max.

min

Type: number
Default: 0

Minimum float to return.

max

Type: number
Default: 1

Maximum float to return.

Related

random-int Build Status

Generate a random integer

Usage

var randomInt = random.randomInt;
randomInt(5);
//=> 3

randomInt(10, 100);
//=> 54

API

randomInt(max)

Returns an integer from 0 to max.

randomInt(min, max)

Returns an integer from min to max.

min

Type: number
Default: 0

Minimum integer to return.

max

Type: number
Default: 1

Maximum integer to return.

Related

License

MIT © Sindre Sorhus

Current Tags

  • 1.0.2                                ...           latest (2 years ago)

3 Versions

  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |