1import gleam/float2import gleeunit/should3import klotski/prng45/// The generators have to agree with the proof of concept's to the bit, or a6/// rung that looked one way in the mockup looks another here -- which is the7/// one thing a seeded system exists to prevent.8pub fn fnv_matches_the_reference_test() {9 prng.hash_string("classic") |> should.equal(1_210_346_835)10 prng.hash_string("walk|3|2|1") |> should.equal(4_082_546_268)11}1213pub fn mulberry_matches_the_reference_test() {14 let rng = prng.mulberry(prng.hash_string("classic|macintosh") + 8191)15 let #(a, rng) = prng.next(rng)16 let #(b, rng) = prng.next(rng)17 let #(c, rng) = prng.next(rng)18 let #(d, _) = prng.next(rng)19 [a, b, c, d]20 |> list_round21 |> should.equal([685_895, 792_959, 717_388, 484_567])22}2324fn list_round(values: List(Float)) -> List(Int) {25 case values {26 [] -> []27 [value, ..rest] -> [28 float.round(value *. 1_000_000.0 -. 0.5),29 ..list_round(rest)30 ]31 }32}