SP4CEBAR 2024-02-03 10:07 (Edited)
Whenever I need a random function with a seed I would either fill an array with random values or make a random-ish function myself.
However I could've obviously just done this.
SUB SEED_RANDOM( VALUE, SEED, SCALE )
VALUE = RND( SCALE )
I need a function like this when I have a set of projectiles with random velocities that are updated each frame. In this case I want the random velocities of each object to be the same each frame, using this could save some arrays.
Another case is with terrain generation, where when generated terrain is revisited by the player, you don't want it to look vastly different.
Timo 2024-02-03 11:19
RND already is a fix sequence when it starts with a fix seed.
Try this (seceral times):
FOR I=1 TO 10
SP4CEBAR 2024-02-03 12:17
I know, this is very useful for a fixed order, but in some use cases, the order in which RND is called may vary
was8bit 2024-02-03 15:37 (Edited)
Correct, one seed will only work IF the following sequences of additional RND calls are always the same...
I've done this for random world maps, but there cannot be different paths in the generation, each generation path must have the exact sequence of RND calls, to always get the same world for the same initial seed...