view distr_2.py @ 58:a3aaf6c085f4 simple

pass0, initial display working with Run and Space
author Henry Thompson <ht@markup.co.uk>
date Thu, 01 Jun 2023 19:02:22 +0100
parents bb46148fab91
children
line wrap: on
line source

# experimenting with distributions
# Usage: distr.py N bucketWidth max
import sys, random, signif
from nltk import FreqDist

mu=float(sys.argv[1])
sigma=float(sys.argv[2])
n=int(sys.argv[3])
scale=float(sys.argv[4])
fd=FreqDist()
fd2=FreqDist()
for i in xrange(n):
  fd[round(random.normalvariate(mu,sigma)/scale)]+=1
  fd2[round(random.gauss(mu,sigma)/scale)]+=1
fd.bell(xtra=fd2)