Foreach usage in randomization constraints

In reply to javatea:

A while loop might work in this particular case, but you can get stuck into an infinite loop in other cases. That is why we feed our constraints to a constraint solver which has to prove a solution exists before generating a particular solution.

And I do not think your equation gives the desired curve. It simple flips the curve as a mirror image.