Phaser API Documentation



Gets or Sets the state of the generator. This allows you to retain the values that the generator is using between games, i.e. in a game save file.

To seed this generator with a previously saved state you can pass it as the seed value in your game config, or call this method directly after Phaser has booted.

Call this method with no parameters to return the current state.

If providing a state it should match the same format that this method returns, which is a string with a header !rnd followed by the c, s0, s1 and s2 values respectively, each comma-delimited.


name type arguments description
state string <optional>

Generator state to be set.


The current state of the generator.

  • string