def constrainedRandoms(ranges):
    choices = (v for v in itertools.product(*ranges) if sum(v) == 100)
prob = 0.5
decayFactor = 0.97
try:
    answer = next(choices)
except StopIteration:
    answer = None
for choice in choices:
    answer = choice
if random.uniform(0, 1) >= prob:
    return answer
prob *= decayFactor
return answer
Create constrained random numbers?