>>30928483Here's an attempt at explaining it:
The game stores in a variable a sequence of 127 bits. This is what is known as your "seed". Every time the game wants a random value, it reads the seed, does some math, and returns a number to whatever piece of code wanted a random number. This also changes your seed in the process, since part of the math changes your seed's value.
Here's the catch, this is a deterministic process. If you call the random number function with the same seed every time, you will always get the same random number, and the new seed will always be the same.
So every time you get a random number, you update your seed to its next value. We call this new seed "frame 1", since it is one call away from your original seed. Calling the function again would update the seed, giving you the newer seed "frame 2".
When you accept an egg, a series of calls to the random number function are made, so your seed goes from frame 0 to frame, say 30, after making the egg. When you refuse the egg, only one call is made to the random number function, updating your seed to frame 1.
The first random number call in the code is the gender roll, which is skipped when a pokemon is genderless. This means that, for a gendered pokemon, starting at frame 0 will produce an egg XYZ, but for a genderless pokemon, starting at frame 0 will produce egg YZW, since it never rolled for gender, and thus every call to RNG was off by one seed, giving different results.
By rejecting one egg between the swap, you make it so that when a genderless pokemon calls random number function for the first time, it will be at frame 1 instead of frame 0, as if it had rolled for gender. This allows it to have the exact same results as when you had a gendered parent, since every call to RNG gave you the same number as a result, since the frames were now aligned.
Hopefully this helps you and everyone else understand this a bit better.