From 35f5b34a4eb2b8559d26db663e1a4695cac4d56b Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Sat, 13 Jun 2020 21:17:08 +0200 Subject: [PATCH] Improve storySeed initialisation The storySeed no longer goes through the PRNG on init, and takes the timestamp directly. It also no longer uses modulo 100, which should give more variety. --- src/engine/StoryState.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/StoryState.ts b/src/engine/StoryState.ts index 9a0588c1..35d7d07d 100644 --- a/src/engine/StoryState.ts +++ b/src/engine/StoryState.ts @@ -350,9 +350,9 @@ export class StoryState { this._turnIndices = new Map(); this.currentTurnIndex = -1; - let timeSeed = new Date().getTime(); - this.storySeed = new PRNG(timeSeed).next() % 100; - this.previousRandom = 0; + let timeSeed = Date.now(); + this.storySeed = new PRNG(timeSeed).nextSeed(); + this.previousRandom = this.storySeed; this._currentChoices = [];