MCPcopy Index your code
hub / github.com/codeaashu/claude-code / randomInt

Function randomInt

src/utils/words.ts:767–772  ·  view source on GitHub ↗

* Generate a cryptographically random integer in the range [0, max)

(max: number)

Source from the content-addressed store, hash-verified

765 * Generate a cryptographically random integer in the range [0, max)
766 */
767function randomInt(max: number): number {
768 // Use crypto.randomBytes for better randomness than Math.random
769 const bytes = randomBytes(4)
770 const value = bytes.readUInt32BE(0)
771 return value % max
772}
773
774/**
775 * Pick a random element from an array

Callers 1

pickRandomFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected