summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rules.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/rules.js b/rules.js
index 61ccff5..5ac89f0 100644
--- a/rules.js
+++ b/rules.js
@@ -233,7 +233,9 @@ function abs(x) {
function random(n) {
clear_undo()
- return ((game.seed = game.seed * 69621 % 0x7fffffff) / 0x7fffffff) * n | 0
+ if (game.rng === 1)
+ return ((game.seed = game.seed * 69621 % 0x7fffffff) / 0x7fffffff) * n | 0
+ return (game.seed = game.seed * 200105 % 34359738337) % n
}
function roll_die(reason) {
@@ -9369,6 +9371,10 @@ exports.setup = function (seed, scenario, options) {
log: [],
})
+ // Old RNG for ancient replays
+ if (options.rng)
+ game.rng = options.rng
+
switch (scenario) {
default:
// fallthrough