When are the statistics (IVs/Ability/Gender etc.) for a hatched Pokémon randomised?
Sun and Moon have significantly changed the breeding mechanic. In ORAS, I could save before picking up eggs, hatch them, then soft reset (SR) back to the save, and get a completely new set of eggs (i.e. the egg was determined at the point you collected it from the daycare - more specifically, it's determined at the point you collect the egg before that one).
However, in Sun and Moon, egg statistics (stats/IVs/gender etc) are determined at some point before you pick up the egg from the Daycare. I've saved, collected and hatched 5 Pokémon, SR'd, then collected and hatched the exact same Pokémon, down to their IVs.
I much prefer this method as it means you don't fill up countless boxes with the same inadequate Pokémon in the quest to find one with perfect IVs and Nature (same applies for Masuda Method if shinies are your thing).
See title for the resultant question.
Solution 1:
Eggs are generated when you pick them up. As soon as you choose to receive an Egg, the game calls the Egg RNG (Random Number Generator) to determine the Pokemon's characteristics.
The big difference to previous generations is that this Egg RNG is completely independent and never reseeded. It's exclusively used for eggs and once the starting seed is determined (presumably when the game is first started), it carries over forever and is saved with the game. This leads to soft resets not having any effect and allows for exact predictions assuming the current seed can be determined.
One notable detail is that the PID (which determines shininess and not really anything else nowadays) is generated by yet another RNG, potentially the game's main RNG, and is thus unpredictable for practical purposes. However, when shiny charm or the Masuda method are used, this initial PID is discarded and additional PIDs are generated by the Egg RNG, making shininess predictable again if either or both of these methods is used.
The Japanese community have put a great deal of effort into this and discovered nearly the entire mechanics behind this by the time the English-speaking community independently discovered there was something fishy. There is actually an English guide made by one of the Japanese researchers that details how to determine the current seed and use a tool created for this specific purpose to predict eggs and even search for specific characteristics.
My sources are various, most of them are google-translated Japanese sites and personal experiences. The guide linked above sums up the relevant information for anyone who's not too interested in the actual programming stuff going on.