spec/math/random/source.bend
bend-collections-laws-crypto@1.0.0.0 · 23 lines · 3 definitions
1import Base
2import bend-collections-laws-crypto@1.0.0.0/src/math/u64.bend as W
3
4
5
6
7
8
9def fst64(-S: Data, p: W.U64 & S) -> W.U64:
10 (x, s) = p
11 x
12
13def snd64(-S: Data, p: W.U64 & S) -> S:
14 (x, s) = p
15 s
16
17
18def outputs(~S: Data, ~next: S -> W.U64 & S, n: Nat, +s: S) -> List<&2, W.U64>:
19 match n:
20 case 0n:
21 []
22 case 1n+p:
23 Con{fst64(S, next(s)), outputs(~S, ~next, p, snd64(S, next(s)))}