CMP.9:4.2 - Construct the random operation and its output law
Start with a random primitive whose assumptions are explicit, such as independent uniform bits or uniform integers in a bounded range. A finite generator supplies a particular implementation. Its period, correlations, state reuse or exposure to an adversary matter when the receiving claim depends on them.
For a finite categorical law with known probabilities, a cumulative-probability partition can transform a uniform draw. When generating a uniform integer from b bits for a range of size m, simply taking the remainder can bias the result unless m divides 2^b. One repair accepts only bit values below floor(2^b/m)*m, then takes their remainder; rejected draws are repeated. For 2^b≥m the acceptance probability exceeds one half. With independent draws this procedure terminates almost surely, with fewer than two attempts on average. It gives no fixed upper bound on attempts when rejections are possible. For a hard deadline, a cap introduces an outcome with no draw. Account for that probability if the commission permits failure. If every execution has to return a uniform choice using at most B independent fair bits as its only random source, extend every shorter bit history to length B. The resulting 2^B equally likely histories must divide evenly among the m outcomes. Equal allocation is possible exactly when m divides 2^B.
For a stream, maintain a distributional invariant that survives one new record; :5.1 derives such an update. For a proposal distribution q different from p, either correct the output distribution through an acceptance rule or correct the estimated contribution through weights. Derive which of those results the procedure returns.
When direct draws are unavailable, a transition rule can maintain a desired stationary law. Construct the transition probabilities and the condition that preserves that law. Reachability, convergence from the start and correlations remain additional algorithmic questions; :5.3 shows why an uncorrected neighbor walk can target the wrong distribution.