| 1 | // Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved. |
| 2 | // Use of this source code is governed by an MIT license |
| 3 | // that can be found in the LICENSE file. |
| 4 | module sys |
| 5 | |
| 6 | // Until there's a portable, JS has a seeded way to produce random numbers |
| 7 | // and not just Math.random(), use any of the existing implementations |
| 8 | // as the System's RNG |
| 9 | type SysRNG = WyRandRNG |
| 10 | |
| 11 | // In the JS version, we simply return the same int as is normally generated. |
| 12 | @[inline] |
| 13 | pub fn (r SysRNG) default_rand() int { |
| 14 | return r.int() |
| 15 | } |
| 16 | |