aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-01-05 17:03:20 +0000
committerSean Whitton <spwhitton@spwhitton.name>2019-01-05 17:03:38 +0000
commitbf3ae37e16c4fd61a06de0e8abd98faf7a284094 (patch)
tree9f14108d24473be9646f76ffd498bbc2adde774f
parent0285631e0458cf716abaf534caff6d3f5cad185a (diff)
downloadorg-d20-bf3ae37e16c4fd61a06de0e8abd98faf7a284094.tar.gz
fix off-by-one error in call to `random' to actually roll dice
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--NEWS.md1
-rw-r--r--org-d20.el2
2 files changed, 2 insertions, 1 deletions
diff --git a/NEWS.md b/NEWS.md
index 657c067..a16cf1f 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,6 +1,7 @@
0.3 (unreleased)
----------------
+- Bug fix: off-by-one error in call to `random'
- `org-d20-roll` shows the results on each dice rolled
- New defcustom, `org-d20-letter-monsters`
- New defcustom, `org-d20-continue-monster-numbering`
diff --git a/org-d20.el b/org-d20.el
index 2889839..38f480d 100644
--- a/org-d20.el
+++ b/org-d20.el
@@ -106,7 +106,7 @@ the best N of them, e.g., 4d6k3."
(org-d20--rolls-concat sign rolls (int-to-string times))))
(cons rolls* (+ total (* sign times))))
(while (> times 0)
- (let ((new-roll (1+ (random (- sides 1)))))
+ (let ((new-roll (1+ (random sides))))
(push new-roll new-rolls))
(setq times (- times 1)))
(when keep