I'm doing some procgen stuff and I need a truncated gaussian distribution. Basically, I need a way to get the same thing as this:
import random def truncated_gaussian(mean, deviation, min, max): while True: val = random.gauss(mean, deviation) if min < val < max: return val
except without so much wasted effort. It looks like this is a pretty complicated thing to do properly, but I don't need statistics-grade perfect randomness, just a video-game-grade approximation.
Anyone know a trick to make this work?