projects
/
susannes-git
/
mathe
/
stats
/
bernoulli.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
97cfeeb
)
fix number of bins: yet another off-by-one
main
author
tomás zerolo
<tomas@tuxteam.de>
Sun, 20 Nov 2022 15:58:40 +0000
(16:58 +0100)
committer
tomás zerolo
<tomas@tuxteam.de>
Sun, 20 Nov 2022 15:58:40 +0000
(16:58 +0100)
coinflip-histo.py
patch
|
blob
|
history
diff --git
a/coinflip-histo.py
b/coinflip-histo.py
index 2a737ce2b8689988a8d29d3ac284ce64f5637e71..65c8a44581fa4000b9ac00ebbc6ea2ce7c04a379 100755
(executable)
--- a/
coinflip-histo.py
+++ b/
coinflip-histo.py
@@
-16,5
+16,6
@@
repeats = int(sys.argv[2])
vals = [sum(flipcoins(flips)) for i in range(repeats)]
-plot.hist(vals, bins=flips, align='left')
+# The number of bins must be flips+1: why?
+plot.hist(vals, bins=flips+1, align='left')
plot.show()