Skip to content

Instantly share code, notes, and snippets.

@PastaPastaPasta
Last active August 8, 2018 18:25
Show Gist options
  • Save PastaPastaPasta/b2d5f1a98f980ea735ca8910b49bf972 to your computer and use it in GitHub Desktop.
Save PastaPastaPasta/b2d5f1a98f980ea735ca8910b49bf972 to your computer and use it in GitHub Desktop.
import numpy as np
def getGaus():
gaus = np.random.normal(0.0, 0.33, None)
if gaus < 0:
return getGaus()
else: return gaus
sum = 0
for i in range(0,1000):
sum = sum + getGaus()
print(sum/1000)
print("------------------------------")
Vin = sorted([0,1,2,3,4])
goal = 10
low = Vin[np.argmin(Vin)]
high = Vin[np.argmax(Vin)]
current = 0
print("high")
print(high)
print("low")
print(low)
print("------------------------------")
while not all(i >= goal for i in Vin):
#x = len(Vin) - 1
#while x >= 0:
x, amount=0, 0
amount = int(float(input("What is the number of denoms in this mix?"))) + 1
if amount > len(Vin): amount = (len(Vin) - 1)
for x in range(amount):
#print(Vin)
gaus = getGaus()
current = Vin[x]
#print(current, ":", x)
if current >= goal:
#x = x - 1
#print("changed x: curr ", current)
continue
if low - high == 0:
print(current, " -> ", current + 1, "LOWHIGH")
Vin[x] = Vin[x] + 1
elif (((current + 1)*(current + 1)) / (high * high)) > gaus:
print((current + 1) / (high * high), " > ", gaus)
print(current, " -> ", current + 1)
Vin[x] = Vin[x] + 1
low = Vin[np.argmin(Vin)]
#print("low:", low)
high = Vin[np.argmax(Vin)]
#print("high:", high)
#x = x - 1
Vin = sorted(Vin)
#print(len(Vin) - 1)
#print(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment