def random_bytes
import bend-collections@1.0.0.0/src/crypto/secp256k1.bend as Secp256k1import Base
53def random_bytes(n: Nat, acc: List<&2, U32>) -> IO(List<&2, U32>):
54 match n:
55 case 0n:
56 IO.pure(List<&2, U32>, acc)
57 case 1n+m:
58 do IO<List<&2, U32>>:
59 w : U32 <- IO.try(U32, IO.random_u32())
60 rest : List<&2, U32> <- random_bytes(m, acc)
61 return word_bytes(w, rest)