A collection of functions for use in games.
- dice
- weighted dice
- percentage
$ yarn install
A fair dice roll.
import { rollDice } from "slanted-gamedev-toolz";
const diceSides = 6
const diceRollOutcome = rollDice(diceSides);
Parameter |
Description |
diceSides |
the amount of sides on the dice |
Type |
Description |
number |
the result of the dice roll |
An unfair fair dice roll that is more likely to roll low.
import { rollLowWeightedDice } from "slanted-gamedev-toolz";
const diceSides = 6
const diceRollOutcome = rollLowWeightedDice(diceSides);
Parameter |
Description |
diceSides |
the amount of sides on the dice |
Type |
Description |
number |
the result of the dice roll |
An unfair fair dice roll that is more likely to roll high.
import { rollHighWeightedDice } from "slanted-gamedev-toolz";
const diceSides = 6
const diceRollOutcome = rollHighWeightedDice(diceSides);
Parameter |
Description |
diceSides |
the amount of sides on the dice |
Type |
Description |
number |
the result of the dice roll |