(seed: string)
| 283 | |
| 284 | // Mulberry32 seeded with a hash of `seed`. |
| 285 | const seededRandom = (seed: string): RandomService.Random => { |
| 286 | let state = Hash.string(seed) |
| 287 | const nextDoubleUnsafe = () => { |
| 288 | state = (state + 0x6D2B79F5) | 0 |
| 289 | let t = Math.imul(state ^ (state >>> 15), 1 | state) |
| 290 | t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t |
| 291 | return ((t ^ (t >>> 14)) >>> 0) / 4294967296 |
| 292 | } |
| 293 | return { |
| 294 | nextDoubleUnsafe, |
| 295 | nextIntUnsafe: () => |
| 296 | Math.floor(nextDoubleUnsafe() * (Number.MAX_SAFE_INTEGER - Number.MIN_SAFE_INTEGER + 1)) + |
| 297 | Number.MIN_SAFE_INTEGER |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | /** |
| 302 | * Context reference containing the current activity retry attempt, defaulting |
no test coverage detected