Returns the current random seed.



Returns: Real


To generate a random number GameMaker: Studio starts with a random seed number. With this function you can retrieve that seed, which can then be stored to reproduce a specific series of random events. For example, say you have a procedurally generated game, but want the player to be able to go back to previously discovered areas. Well, at the start of each area, you can store the random seed with this function and so every time you need to go back there, you can use random_set_seed to set the seed to what it was previously and so force GameMaker: Studio to reproduce the same set of "random" functions that it used previously.


ini_write_real("Levels", string(level), random_get_seed());

The above code will get the random seed and store it in an ini file.

Back: Real Number Functions
Next: random_use_old_version
© Copyright YoYo Games Ltd. 2018 All Rights Reserved