MCPcopy Create free account
hub / github.com/Effect-TS/effect / random

Function random

packages/effect/test/Hash.test.ts:182–185  ·  view source on GitHub ↗
(n: number)

Source from the content-addressed store, hash-verified

180 describe("hash law", () => {
181 let seed = 1
182 const random = (n: number): number => {
183 seed = (Math.imul(seed, 1103515245) + 12345) >>> 0
184 return (seed >>> 16) % n
185 }
186 const randomKey = (): unknown => [random(60), `k${random(60)}`, [random(4), random(4)]][random(3)]
187 const shuffle = <A>(values: ReadonlyArray<A>): Array<A> => {
188 const output = [...values]

Callers 4

randomKeyFunction · 0.70
shuffleFunction · 0.70
Hash.test.tsFile · 0.70
Effect.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected