Foreach usage in randomization constraints

In reply to javatea:

Have you verified that you code produces the expected curve? And what is val supposed to be when norm falls outside the low/high range?