Lines Matching full:weights
142 .. function:: choices(population, weights=None, *, cum_weights=None, k=1)
147 If a *weights* sequence is specified, selections are made according to the
148 relative weights. Alternatively, if a *cum_weights* sequence is given, the
149 selections are made according to the cumulative weights (perhaps computed
150 using :func:`itertools.accumulate`). For example, the relative weights
151 ``[10, 5, 30, 5]`` are equivalent to the cumulative weights
152 ``[10, 15, 45, 50]``. Internally, the relative weights are converted to
153 cumulative weights before making selections, so supplying the cumulative
154 weights saves work.
156 If neither *weights* nor *cum_weights* are specified, selections are made
157 with equal probability. If a weights sequence is supplied, it must be
159 to specify both *weights* and *cum_weights*.
161 The *weights* or *cum_weights* can use any numeric type that interoperates