diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fd1294f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +charset = utf-8 +trim_trailing_whitespace = true + +end_of_line = lf +insert_final_newline = true + +indent_style = space +indent_size = 4 diff --git a/README.md b/README.md new file mode 100644 index 0000000..c1e62c7 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Dice +Given a set of dice, calculates the probability density graph of each value that can be rolled. diff --git a/index.html b/index.html index df4dade..ebb3f01 100644 --- a/index.html +++ b/index.html @@ -5,18 +5,14 @@ - + Dice probabilities | FWDekker - - - +
@@ -24,8 +20,15 @@

Dice probabilities

+
-

Calculates the probability of throwing a value given a combination of dice.

+

Calculates the probability of rolling a value given a combination of dice.

@@ -41,7 +44,7 @@ Sides per die - Number of throws + Number of rolls @@ -81,6 +84,8 @@ Licensed under the MIT License. Source code available on git. + +
v1.0.8
@@ -243,9 +248,9 @@ const dieRollFreqs = rollFreqs.concat(repeat(0, die)); rollFreqs = repeat(0, dieRollFreqs.length); - rangeInclusive(1, die).forEach(throwValue => { + rangeInclusive(1, die).forEach(rollValue => { rangeExclusive(1, dieRollFreqs.length - die).forEach(i => { - rollFreqs[throwValue + i] += dieRollFreqs[i]; + rollFreqs[rollValue + i] += dieRollFreqs[i]; }); }); });