When the Pokemon Games were created, there should be some random values in it, such as IVs and shiny status, that give it some factor to make the game funnier/harder/whatever. Problem is, you cannot make a programm truely randomizing things as programms always need an input to create an output. Thus, the "random number calculator" (short RNG) that was implemented ingame also needs something to make random numbers out of it - which is basically a combination of the time you start your game and an ingame value calculated by things such as the steps a non player character does. Now, if you can hack the game, you can find out the randomizing method, using this knowledge to manipulate it in exactly the way you need to get a pokemon with perfect IVs or a shiny one (or even both if you also manipulated your player ID like I did in Diamond).