>
> def __int__(self, x, y):
>     x = -1
>    while not 0 <= x <= 100:
>        x = normalvariate(x, y)
>    # do other stuff
>
> That is the correct way to truncate a normal distribution.
>
>
Thanks for the response. But why would you set the mean to -1 to begin?



>
> x = max(0, min(100, normalvariate(x, y)))
>
>
That is an awesome way of shorthanding clamp.

Best regards,

Ching-Yun "Xavier" Ho, Technical Artist

Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to