randum

0.0.2 • Public • Published

randum

Stores parameters used to randomly generate items.

Installation

npm install randum

Usage

Random Integers

Storing parameters and generating a random item.

var randum = require('randum');
 
// print a random int from 1 to 10
randum.int('foo', 1, 10);
console.log(randum.get('foo'));

Random Floats

The final parameter in float is precision, the value passed to toFixed before output is passed to parseFloat.

// print a randum float from 5.5 to 10
randum.float('foo', 5.5, 10, 2);
console.log(randum.get('foo'));

Random Array Item

// prints a, b, or c
randum.array('foo', ['a', 'b', 'c']);
console.log(randum.get('foo'));

Test

randum uses the Jest testing framework. Run npm test to execute all tests.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    2
  • 0.0.1
    1

Package Sidebar

Install

npm i randum

Weekly Downloads

2

Version

0.0.2

License

ISC

Unpacked Size

6.42 kB

Total Files

4

Last publish

Collaborators

  • darthhahn