1.0.3 • Published 8 years ago

random-hour v1.0.3

Weekly downloads
556
License
MIT
Repository
github
Last release
8 years ago

random-hour

Generate a random hour.

MIT License

build:? coverage:?

Install

$ npm install --save random-hour 

Usage

var randomHour = require('random-hour');

// API
// - randomHour([options]);

// options
// - twentyFour
// - min
// - max

By default, returns an hour from 1 to 12 for a standard 12-hour clock:

randomHour();
// => 9

Can optionally specify a full twenty-four:

randomHour({ twentyFour: true });
// => 14

Optionally specify min, max, or both to limit the range.

randomHour({ min: 10 });
// => 11

randomHour({ max: 10 });
// => 7

randomHour({ min: 5, max: 10 });
// => 8

Related

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.