def next_except.go

unified-nsga-iii@0.2.2.0 · rng.bend:95

import unified-nsga-iii@0.2.2.0/rng.bend as Rng
import Base

95# C# NextExcept: uniform in [0, n) distinct from exclude when n > 1.
96def next_except.go(s: State, +exclude: Nat, n: Nat) -> State:
97  match n:
98    case 0n:
99      with_k(s, 0n)
100    case 1n:
101      with_k(s, 0n)
102    case 1n+m:
103      +s2 = next_nat(s, m)
104      +v = last_nat(s2)
105      with_k(s2, bump_except(v, exclude, Nat.is_lt(v, exclude)))

Uses (7)

Used by (1)