I was under the impression it was randomly generated, or near random, i.e. if you return to a place it may alter in the generation slightly.
...
Well, that's sort of understandable, because procedural generation does entail random generation to an extent, it's just that the randomness is pre-determined
Think of it like this. Imagine you rolled a dice and noted the number that came up. Then you roll again, and again etc. 400 billion times. That would be absurd to do, but it would give you a list of 400 billion random numbers. Then you assign a number to each star in a game to determine the type of star, and note the serial number of the star.
Now you have random access to your random number list, so it doesn't matter if no-one has ever been to star number 654,387 (which we'll say has random number "5"), the fact is that when anyone gets there the random number will come into play and be used to generate the type of star etc. Every time anyone comes there, it will always have the same random number because it was pre-assigned
Now, procedural generation is just a way to do what I've described above but by using a mathematical formula to simulate all the dice rolls. Computers do this sort of stuff very well, so suddenly the absurd scenario of all those dice rolls is practical ad happens in seconds.
That's all oversimplified, of course, and it involves much more, but basically that's why everything, even down to the last blade of grass, that is modelled in a pg game is always the same for every player.
No magic, just math
