def bytes.go

bend-kit-property@0.4.0.0 · generate.bend:68

import bend-kit-property@0.4.0.0/generate.bend as Generate
import Base
import bend-kit-random@0.1.0.1/random.bend as Rand
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

68# Byte i and the n bytes after it; xr holds byte i (Bytes.set keeps its low 8 bits).
69def bytes.go(n: Nat, b: Bytes.Bytes, +i: U32, xr: U32 & Rand.Rng) -> Bytes.Bytes & Rand.Rng:
70  match n:
71    case 0n:
72      (x, r) = xr
73      (Bytes.set(b, i, x), r)
74    case 1n+p:
75      (x, r) = xr
76      bytes.go(p, Bytes.set(b, i, x), (i + 1 : U32), Rand.next(r))

Uses (9)

Used by (1)