def random_bytes
import bend-collections-laws-crypto@1.0.0.0/src/crypto/kex.bend as Keximport Base
36def random_bytes(n: Nat, acc: List<&2, U32>) -> IO(List<&2, U32>):
37 match n:
38 case 0n:
39 IO.pure(List<&2, U32>, acc)
40 case 1n+m:
41 do IO<List<&2, U32>>:
42 w : U32 <- IO.try(U32, IO.random_u32())
43 rest : List<&2, U32> <- random_bytes(m, acc)
44 return word_bytes(w, rest)