Dice for JS
yarn add @sudoo/dice
# Or
npm install @sudoo/dice --save
Single dice
import { Dice } from "@sudoo/dice";
const cubeDice = Dice.cube();
cubeDice.roll(); // 1-6
Multiple Dices
import { Dice, DiceCup } from "@sudoo/dice";
const dices = DiceCup.create(
Dice.cube(),
Dice.cube(),
);
dices.rollAll().currentSum(); // 2-12