Talk:cpp/numeric/random/discrete distribution/discrete distribution
From cppreference.com
< Talk:cpp | numeric/random
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)