Mercurial > hg > python
view distr_1.py @ 59:c22f83e049a9 simple
check0 works for nono10,
but is broken in that col 3 w/o the row 7 hit would find the row 3 hit
as satisfying the last (2nd) run, which isn't _necessarily_ correct
author | Henry Thompson <ht@markup.co.uk> |
---|---|
date | Sat, 03 Jun 2023 22:11:12 +0100 |
parents | 6c389c0f1b40 |
children |
line wrap: on
line source
#!/usr/bin/python3 '''Display a bell curve for a fake normal distribution''' # experimenting with normal distributions of coin flips # Usage: distr.py Nexprs Mflips [differentN] # Requires python3.6 as of 2021-07-28 import sys, random, signif from nltk import FreqDist n=int(sys.argv[1]) m=int(sys.argv[2]) if len(sys.argv)>3: nn=int(sys.argv[3]) else: nn=None fd=FreqDist() for i in range(n): fd[sum(random.randint(0,1) for i in range(m))]+=1 if nn is not None: fd2=FreqDist() for i in range(nn): fd2[sum(random.randint(0,1) for i in range(m))]+=1 fd.bell(xtra=fd2) else: fd.bell()