def next

bend-kit-random@0.1.0.1 · random.bend:37

import bend-kit-random@0.1.0.1/random.bend as Random
import Base

37# One xoshiro128** step: a uniform U32 and the next state.
38def next(r: Rng) -> U32 & Rng:
39  match r:
40    case Rng{+a, +b, +c, +d}:
41      +c1 = (c .^. a : U32)
42      +d1 = (d .^. b : U32)
43      ((rotl((b * 5 : U32), 7n, 25n) * 9 : U32),
44        Rng{(a .^. d1 : U32), (b .^. c1 : U32), (c1 .^. (b << 9n) : U32),
45          rotl(d1, 11n, 21n)})

Uses (8)

Used by (6)