random-bool

1.0.2 • Public • Published

random-bool

Return a random boolean value (true or false).

MIT License

build:? coverage:?

Install

$ npm install --save random-bool 

Usage

For more use-cases see the tests.

var randomBool = require('random-bool');
 
// API
// - randomBool([options])
 
// options
// - likelihood

The default likelihood of success (returning true) is 50%:

randomBool(); 
// => true

Can optionally specify the likelihood in percent:

randomBool({ likelihood: 30 });
// => false

In this case only a 30% likelihood of true, and a 70% likelihood of false.

Related

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    540
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    540
  • 1.0.1
    0
  • 1.0.0
    0
  • 0.0.0
    0

Package Sidebar

Install

npm i random-bool

Weekly Downloads

540

Version

1.0.2

License

MIT

Last publish

Collaborators

  • bubkoo