Use seedrandom to back PseudoRandom.ts (#1828)

## Description:

The previous implementation had a bug that biased numbers away from 0,
so random.chance(1500+) would always return false. This caused trains to
not spawn at all when their spawn rate was sufficiently low. We should
be using a library instead of implementing it from scratch anyways.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
This commit is contained in:
evanpelle
2025-08-16 18:03:25 -07:00
committed by GitHub
parent bce2b80486
commit 77fd82b4b4
3 changed files with 38 additions and 103 deletions
+2
View File
@@ -41,6 +41,7 @@
"@types/msgpack5": "^3.4.6",
"@types/node": "^22.10.2",
"@types/pg": "^8.11.11",
"@types/seedrandom": "^3.0.8",
"@types/sinon": "^17.0.3",
"@types/systeminformation": "^3.23.1",
"@types/ws": "^8.5.11",
@@ -118,6 +119,7 @@
"js-yaml": "^4.1.0",
"nanoid": "^3.3.6",
"obscenity": "^0.4.3",
"seedrandom": "^3.0.5",
"ts-node": "^10.9.2",
"uuid": "^11.1.0",
"winston": "^3.17.0",