random-hour

1.0.3 • Public • Published

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.

Package Sidebar

Install

npm i random-hour

Weekly Downloads

371

Version

1.0.3

License

MIT

Last publish

Collaborators

  • bubkoo