Skip to content

Commit

Permalink
Improve storySeed initialisation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
PiOverFour committed Mar 30, 2021
1 parent 960a850 commit 35f5b34
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/engine/StoryState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down

0 comments on commit 35f5b34

Please sign in to comment.