From: tomás zerolo Date: Sun, 20 Nov 2022 15:58:40 +0000 (+0100) Subject: fix number of bins: yet another off-by-one X-Git-Url: http://git.tuxteam.de/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmain;p=susannes-git%2Fmathe%2Fstats%2Fbernoulli.git fix number of bins: yet another off-by-one --- 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()