MCPcopy Index your code
hub / github.com/tldraw/tldraw / randomInt

Method randomInt

packages/sync-core/src/test/RandomSource.ts:7–19  ·  view source on GitHub ↗
(lo?: number, hi?: number)

Source from the content-addressed store, hash-verified

5 randomInt(lessThan: number): number
6 randomInt(fromInclusive: number, toExclusive: number): number
7 randomInt(lo?: number, hi?: number) {
8 if (lo === undefined) {
9 lo = Number.MAX_SAFE_INTEGER
10 }
11 if (hi === undefined) {
12 hi = lo
13 lo = 0
14 }
15 this._seed = (this._seed * 9301 + 49297) % 233280
16 // float is a number between 0 and 1
17 const float = this._seed / 233280
18 return lo + Math.floor(float * (hi - lo))
19 }
20
21 randomAction<Result>(
22 // eslint-disable-next-line tldraw/method-signature-style

Callers 6

getWeightFromChoiceMethod · 0.95
randomActionMethod · 0.95
randomElementMethod · 0.95
getRandomOpMethod · 0.80
nanoidFunction · 0.80
runTestFunction · 0.80

Calls

no outgoing calls

Tested by 2

nanoidFunction · 0.64
runTestFunction · 0.64