def rand_xs.go

unified-nsga-iii@0.2.2.0 · algorithm.bend:93

import unified-nsga-iii@0.2.2.0/algorithm.bend as Algorithm
import Base
import unified-nsga-iii@0.2.2.0/bounds.bend as Bounds
import unified-nsga-iii@0.2.2.0/rng.bend as Rng

93def rand_xs.go(+box: Bounds.Box, fuel: Nat, +i: Nat, rng: Rng.State, acc: List<&2, F32>) -> Rng.State & List<&2, F32>:
94  match fuel:
95    case 0n:
96      (rng, List.reverse(&2, F32, acc))
97    case 1n+f:
98      +iv = Bounds.at(box, i)
99      +rng2 = Rng.next_double(rng)
100      +lo = Bounds.lo(iv)
101      +hi = Bounds.hi(iv)
102      rand_xs.go(
103        box,
104        f,
105        1n+i,
106        rng2,
107        F32.add(lo, F32.mul(F32.sub(hi, lo), Rng.last_double(rng2))) <> acc
108      )

Uses (16)

Used by (1)