rando-js

0.2.0 • Public • Published

A file with utility methods for introducing randomness.

Install with npm install rando-js --save.

Use cases:

const Random = require('rando-js');
 
// Simulate a coinflip
if (Random.coinflip()) { /* something that has ~50% chance of happening */ }
 
// Roll a stat for your D&D character
const charisma = Random.roll(3, 6) // anything from 3 to 18
const d20 = Random.roll() // default args are 1, 20.
 
// Get something from an array
const choice = Random.fromArray([a, b, c, d]) // a, b, c, or d
 
// Get a random number in a range
const under20 = Random.inRange(0, 20)
 

Package Sidebar

Install

npm i rando-js

Weekly Downloads

4

Version

0.2.0

License

MIT

Unpacked Size

9.54 kB

Total Files

8

Last publish

Collaborators

  • seanohue