(lo?: number, hi?: number)
| 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 |
no outgoing calls