@rojo2/random

1.0.1 • Public • Published

Random

Travis CI

const random = require("rojo2-random");

// reset random seed
random.reset(0);

// get random value between 0 and 1
random.value();

// get random value between min and max
random.between(min, max);

// get random index between 0 and list.length - 1
random.index(list);

// get a random value from [1,2,3]
random.pickOne([1,2,3]);

// take a random value from [1,2,3]
// after calling this function
// if the returned value is 2
// the array is going to be [1,3]
random.takeOne([1,2,3]);

random.fudgeDice();
random.fudgeDices();

random.regularDice();
random.regularDices();

random.dice();
random.dices();

random.roll(["2d6","4d12","1d2"]);
random.roll("2d6,4d12,1d2");

NOTE: This library uses an LCG, probably the most simple and basic pseudo-random number generator. DON'T USE THIS TO GENERATE CRYPTOGRAPHIC RANDOM NUMBERS!

Made with by ROJO 2 (http://rojo2.com)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    1

Package Sidebar

Install

npm i @rojo2/random

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • azazeln28
  • aitormm