Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,24 @@
F modifier(Float x) -> Float
R I x < 0.5 {2 * (.5 - x)} E 2 * (x - .5)
F modified_random_distribution((Float -> Float) modifier, Int n) -> [Float]
[Float] d
L d.len < n
V prob = random:()
I random:() < modifier(prob)
d.append(prob)
R d
V data = modified_random_distribution(modifier, 50'000)
V bins = 15
DefaultDict[Int, Int] counts
L(d) data
counts[d I/ (1 / bins)]++
V mx = max(counts.values())
print(" BIN, COUNTS, DELTA: HISTOGRAM\n")
Float? last
L(b, count) sorted(counts.items())
V delta = I last == N {N/A} E String(count - last)
print( #2.2, #4, #4: .format(Float(b) / bins, count, delta)(# * Int(40 * count / mx)))
last = count