Namespaces
Variants
Actions

Talk:cpp/numeric/random/discrete distribution/discrete distribution

From cppreference.com

Typography complicates the reading of the (otherwise correct) formula for the unary_op() constructor. What about this ?

 w_i = unary_op(xmin + delta * (i + 0.5))  where delta = (xmax - xmin) / count and 0 <= i < count

In layman’s words: the formula splits [xmin,xmax] into "count" segment, and it computes unary_op() at the middle of each segment.

(reason for this comment: I had read i.delta as i-delta in the original formula, and that did not make much sense)

yes, that looks like a minus at the first glance to me as well - rearranged --Cubbi (talk) 06:56, 10 February 2022 (PST)