PKHeX source code is always an useful learning resource: https://github.com/kwsch/PKHeX/blob/daf9ad76c9b48b21ffcd91efc884eabc26b140d6/PKHeX.Core/Legality/RNG/PIDGenerator.cs#L250
As far as I can remember, IVs are not correlated to PID so you can edit IVs as you wish once you have a legal PID.
Or, just use a generated template for Pokewalker mons (either obtained from encounter database [I've not checked, but they may be there] or from the link I gave you in another thread), then modify the details there.