Skip to content

Commit

Permalink
Improve storySeed initialisation
Browse files Browse the repository at this point in the history
The storySeed now takes the timestamp directly and the initial seed is
stored as the storySeed.

It also no longer uses modulo 100, which should give a lot more
variety.
  • Loading branch information
PiOverFour committed Mar 31, 2021
1 parent 860798b commit 08bd60e
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 08bd60e

Please sign in to comment.