A simple tool designed to roll dices, of any side: d2 (flip coin), d3, d4, d6, d8, d12, d20, d30, d60, d100, d1000, and jan-ken-po.
npm i rolld20
yarn add rolld20
import { d2, flipCoin } from 'rolld20'
// Rolling d2 🎲👋
d2(); // return a random number between 1-2;
d2(10); // return an array of 10 elements with random numbers between 1-2;
flipCoin(); // return a string: 'heads' or 'tails" at random;
import { d3 } from 'rolld20'
// Rolling d3 🎲👋
d3(); // return a random number between 1-3;
d3(10); // return an array of 10 elements with random numbers between 1-3;
import { d4 } from 'rolld20'
// Rolling d4 🎲👋
d4(); // return a random number between 1-4;
d4(10); // return an array of 10 elements with random numbers between 1-4;
import { d6 } from 'rolld20'
// Rolling d6 🎲👋
d6(); // return a random number between 1-6;
d6(10); // return an array of 10 elements with random numbers between 1-6;
import { d8 } from 'rolld20'
// Rolling d8 🎲👋
d8(); // return a random number between 1-8;
d8(10); // return an array of 10 elements with random numbers between 1-8;
import { d10 } from 'rolld20'
// Rolling d10 🎲👋
d10(); // return a random number between 1-10;
d10(10); // return an array of 10 elements with random numbers between 1-10;
import { d12 } from 'rolld20'
// Rolling d12 🎲👋
d12(); // return a random number between 1-12;
d12(10); // return an array of 10 elements with random numbers between 1-12;
import { d20 } from 'rolld20'
// Rolling d20 🎲👋
d20(); // return a random number between 1-20;
d20(10); // return an array of 10 elements with random numbers between 1-20;
import { d30 } from 'rolld20'
// Rolling d30 🎲👋
d30(); // return a random number between 1-30;
d30(10); // return an array of 10 elements with random numbers between 1-30;
import { d60 } from 'rolld20'
// Rolling d60 🎲👋
d60(); // return a random number between 1-60;
d60(10); // return an array of 10 elements with random numbers between 1-60;
import { d100 } from 'rolld20'
// Rolling d100 🎲👋
d100(); // return a random number between 1-100;
d100(10); // return an array of 10 elements with random numbers between 1-100;
import { d1000 } from 'rolld20'
// Rolling d1000 🎲👋
d1000(); // return a random number between 1-1000;
d1000(10); // return an array of 10 elements with random numbers between 1-1000;
import { janKenPo } from 'rolld20'
// Rolling jan-ken-po ✊✋✌️
janKenPo(); // return a string: 'rock', 'paper', or 'scissors' at random;
// Rolling jan-ken-po with bomb allowed ✊✋✌️👍
janKenPo(true); // return a string: 'rock', 'paper', 'scissors', or 'bomb' at random;
import { compareJanKenPo } from 'rolld20'
// Compare two jan-ken-po ✊✋✌️👍 x ✊✋✌️👍
compareJanKenPo('paper', 'bomb'); // return 1 (bomb beats paper)
compareJanKenPo('scissor', 'paper'); // return -1 (scissors beats papaer)
compareJanKenPo('rock', 'rock'); // return 0 (it's a tie)
See the source code here.