We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0d134c4 commit f3df71cCopy full SHA for f3df71c
1 file changed
source/library/roll.js
@@ -1,3 +1,11 @@
1
+/**
2
+ * Rolls a specified number of dice with a given number of sides and returns the results and total.
3
+ *
4
+ * @param {string} dice - The dice notation string (e.g., "2d6" for rolling two six-sided dice).
5
+ * @returns {{ results: number[], total: number }} An object containing an array of individual roll results and their total sum.
6
+ * @example
7
+ * roll("3d4"); // { results: [2, 4, 1], total: 7 }
8
+ */
9
export default function roll(dice) {
10
const [quantity, sides] = dice.split("d").map((x) => parseInt(x));
11
0 commit comments