MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / randomInt

Function randomInt

packages/testkit/src/fuzz.ts:84–91  ·  view source on GitHub ↗
(rng: Rng, min: number, max: number)

Source from the content-addressed store, hash-verified

82}
83
84export function randomInt(rng: Rng, min: number, max: number): number {
85 assertInteger("min", min);
86 assertInteger("max", max);
87 if (max < min) {
88 throw new Error(`randomInt: max must be >= min (got min=${String(min)} max=${String(max)})`);
89 }
90 return min + (rng.u32() % (max - min + 1));
91}
92
93export function chance(rng: Rng, percent: number): boolean {
94 assertInteger("percent", percent);

Callers 15

randomTextFunction · 0.90
buildDocFunction · 0.90
appendInRandomChunksFunction · 0.90
buildStructuredDocFunction · 0.90
parse.fuzz.test.tsFile · 0.90
randomOptionsFunction · 0.90

Calls 1

assertIntegerFunction · 0.85

Tested by 15

randomTextFunction · 0.72
buildDocFunction · 0.72
appendInRandomChunksFunction · 0.72
buildStructuredDocFunction · 0.72
randomOptionsFunction · 0.72
randomIdsFunction · 0.72
randomKnownIdFunction · 0.72
randomKnownUnknownOrNullFunction · 0.72
randomNonRoutingEventFunction · 0.72
randomKeyRoutingEventFunction · 0.72
randomMouseRoutingEventFunction · 0.72
randomWheelCtxFunction · 0.72