def retry

bend-collections-laws-crypto@1.0.0.0 · src/math/random/rand.bend:132

import bend-collections-laws-crypto@1.0.0.0/src/math/random/rand.bend as Rand
import Base
import bend-collections-laws-crypto@1.0.0.0/src/math/u64.bend as W

132# fuel rejection steps (an accepted draw is a fixed point of step)
133def retry(~S: Data, ~next: S -> W.U64 & S, fuel: Nat, +n: W.U64, +t: W.U64, d: Draw<S>) -> Draw<S>:
134  match fuel:
135    case 0n:
136      d
137    case 1n+f:
138      retry(~S, ~next, f, n, t, step(~S, ~next, n, t, d))

Uses (5)

Used by (6)