Something went wrong. Try again.
geometric packing game (tetris-ish) on an icosahedron
Something went wrong. Try again.
805 B · 19 lines
TypeScript
at multiplayer
1234567891011121314151617181920import { describe, expect, it } from "vitest";import { RNG_VERSION, SeededRandom, randomStateAfter } from "./random";
describe("mulberry32-v1 compatibility", () => { it.each([ [0, [1144304738, 1416247, 958946056, 627933444, 2007157716, 2340967985]], [1, [2693262067, 11749833, 2265367787, 4213581821, 4159151403, 1207330352]], [0xffff_ffff, [3850105811, 813802916, 3073704848, 4054706436, 3630262831, 2315588663]], ] as const)("preserves exact outputs for seed %i, including state wraparound", (seed, expected) => { const random = new SeededRandom(seed);
expect(RNG_VERSION).toBe("mulberry32-v1");
for (const output of expected) { expect(random.next()).toBe(output / 4294967296); expect(random.state).toBe(randomStateAfter(seed, random.draws)); } });});