[metapost] Drawing a urn

Troy Henderson thenders at gmail.com
Thu Nov 29 14:01:52 CET 2007


Try replacing

>      if (i <= 5 ):


       if (normaldeviate <= 0.176374 ):

If I understand your problem correctly, this should solve both of your
questions.  The reason for choosing 0.176374 is because normaldeviate
is a normally distributed (pseudo) random number whose mean is 0 and
whose standard deviation is 1, and the probability that such a number
is <= 0.176374 is 0.57.  Obviously, you would want to change that
value if you decide to change your probability.

Troy Henderson
Assistant Professor
Department of Mathematics
University of Mobile

More information about the metapost mailing list