0.3.5 • Published 5 years ago

@js-random/boolean v0.3.5

Weekly downloads
16
License
MIT
Repository
github
Last release
5 years ago

@js-random/boolean

A simple and lightweight boolean randomizer for JavaScript (TypeScript friendly)

Installation

npm i -S @js-random/boolean

Usage

commonjs:

var randomBoolean = require('@js-random/boolean').default;

TS/ES6+:

import randomBoolean from '@js-random/boolean';

<script> tag:

<script src="https://unpkg.com/@js-random/boolean"></script>
var boolean = randomBoolean(); // from 0 to 100 (inclusive)
var fromTwoToTen = randomBoolean(2, 10); // random boolean from `2` to `10` (inclusive)

Global version

This package also has a global version, which introduces side-effects by exposing the api as Boolean.random() function.

Import

commonjs:

require('@js-random/boolean/lib/global');

ES6+:

import '@js-random/boolean/module/global';

TS:

import '@js-random/boolean/module/global';

<script> tag

<script src="https://unpkg.com/@js-random/boolean/unpkg/global"></script>

Usage

var boolean = Boolean.random(); // `true` or `false`

var probablyTrue = Boolean.random(0.99); // 99% chance of getting `true`

Other packages

Please, have a look at other packages from @js-random series:

0.3.5

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.2

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago