Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
some weird gauss
import random
target_diffusion = 0.1
population=[[0,8,4], [2,7,2]]
pop_diffusion=[abs(0.1*max(x)) for x in zip(*population)]
individual=population[0]
while True:
rand_diffusion=[random.gauss(0, v) for v in diffusion]
if sum(rand_diffusion) != 0.0:
break # :)
individual_diffused = [random.gauss(x_val, v * target_diffusion * sum(individual) / sum(rand_diffusion)) for x_val, v in zip(individual, rand_diffusion)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.