As we can use randomise() function but what's the speciality of random_get_seed() ?
here i attach another link about random ssed ...
here i attach another link about random ssed ...
Random seed - Wikipedia
en.m.wikipedia.org
randomise()
you are telling the computer to pick a new seed (or string of numbers) to use whenever a random function is called. By saving and/or setting the seed, you can "force" the computer to use particular series of numbers, which will generally mean the same output from the RNG. It's not really important if you are just wanting to generate random numbers, as the numbers will still be "random" regardless of if you are setting a seed or not. But in particular circumstances, you might want to be able to save and retrieve a particular seed to use (an example would be in Minecraft, you can "save" the starting state of any world by saving the seed, and loading a world from that seed will generate the same world again, rather than a new one).Actually, I am trying to create a room where a rood will be generated randomly. every time after entering the room it will show a different path. but the starting point and ending point will be the same. can anyone help me with this type of workA way to think of the random number generator is as a series of numbers (1, 5, 7, 3, 10, 8, 7, 7, etc). Whenever you call a random function, it picks a number from that list, then moves on to the next (starting at position 0). So the first time you call random, it'll pick 1 and generate an output based on the number 1. The next time you call random, it will pick 5 (since that's next in the list) and generate an output based on that and so on. The output isn't necessarily going to BE the number it picks, but it will be based off that number.
That string of numbers is what you could call your "seed" in a sense. If you stick with the same seed each time you start the game, the random numbers you get will be the same numbers in the same order, which means the random functions will return the same numbers in the same order as the previous time you booted the game. If you change the seed, it will be a different set of numbers, which means the random functions will return different numbers.
By usingrandomise()
you are telling the computer to pick a new seed (or string of numbers) to use whenever a random function is called. By saving and/or setting the seed, you can "force" the computer to use particular series of numbers, which will generally mean the same output from the RNG. It's not really important if you are just wanting to generate random numbers, as the numbers will still be "random" regardless of if you are setting a seed or not. But in particular circumstances, you might want to be able to save and retrieve a particular seed to use (an example would be in Minecraft, you can "save" the starting state of any world by saving the seed, and loading a world from that seed will generate the same world again, rather than a new one).
randomise()
. However, the particular seed (let's call it seed 1) doesn't have anything to do with randomness between rooms or anything like that. Seed 1, when run will have a number of particular outcomes when you call random in room 1. If you then leave room 1 or reset room 1, the random calls will be different. You can simply call randomise()
and it will always be completely random. That's why I said: "It's not really important if you are just wanting to generate random numbers" because setting or loading seeds or worrying about seeds at all isn't related to just simple random number generation. It's related to the overall lower-level architecture that random functions draw from. It won't affect whether things are "random" or not.If the start and end points are all that matter, then you don't need to save the seed, you need to save the start and end points. If the entire path itself needs to be the same while the terrain around it changes, then you should set the seed and generate the path, then randomize the seed and generate the terrain.Actually, I am trying to create a room where a rood will be generated randomly. every time after entering the room it will show a different path. but the starting point and ending point will be the same. can anyone help me with this type of work