From 24d52ab6447ce4a55e4cb35211201b1eb85d2887 Mon Sep 17 00:00:00 2001 From: =?utf8?q?tom=C3=A1s=20zerolo?= Date: Sun, 20 Nov 2022 16:58:40 +0100 Subject: [PATCH] fix number of bins: yet another off-by-one --- coinflip-histo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/coinflip-histo.py b/coinflip-histo.py index 2a737ce..65c8a44 100755 --- 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() -- 2.30.2