assert(false)
Ali Çehreli
acehreli at yahoo.com
Fri Jun 21 09:45:55 PDT 2013
On 06/21/2013 02:56 AM, Joseph Rushton Wakeling wrote:
> I did also have to think about it for a few seconds. You have
> a sum of values from an array; you generate a
> uniformly-distributed random number point in [0.0, sum); you
> sequentially sum values from the same array, and return when
> that partial sum ("mass") exceeds the value of point. Since
> point < sum you must do this eventually
I spent a considerable amount of time reading that function as well. :)
I was afraid whether two separate floating point sums would give the
same result. After all, the initial sum is a 'double' but the type of
the elements of 'proportions' may be different. (I don't know the answer.)
Ali
More information about the Digitalmars-d-learn
mailing list