Am Di., 18. Aug. 2020 um 20:54 Uhr schrieb John Cowan <xxxxxx@ccil.org>:
The text now uses the approach where the probability of using the last source is not given, and it is 1 - sum of all the rest (and it is an error if this is negative).

Is everyone satisfied with this?

The error condition is not stable with respect to numerical errors. For example, one may want to arrange a categorical generator so that the last probability is zero up to rounding errors.

Or, assume weights x, y, z are given. The corresponding probabilities are x/(x + y + z), y/(x + y + z), z/(x + y + z). The categorical generator of SRFI 194 would be:

(let ((s (+ x y z)))
  (make-categorical-generator (vector (/ x s) (/ y s))))

However, due to rounding errors, it may be that (negative? (- 1 (+ (/ x s) (/ y s)))) evaluates to true.

If you change the probability vector into a weight vector (as above), the numerical instability of the error condition vanishes. All you need is that the weights are non-negative and that their sum is positive.