Basically for rerolling or defining artifacts you're guaranteed 2 (or more) to go on your chosen substats but how does Genshin's rng work?

My question is whether or not the guarantee only comes in after you have sufficient upgrades that went to the bad stats. I've had a few artifact definitions where I end up with a lv 12 piece with no enhancements on the chosen substats. Does the guarantee only kick in after lv12 to ensure that I have at least 2 good upgrades?

For example, when I do the feather reroll that guarantees 4 substats which happens?
1. 4 are guaranteed and only the 5th substat is a 50/50
2. If I want all 5 substats to be on the preffered stats I still need to win all 5 50/50s

Any help would be much appreciated 🙏🙏

Question on how artifact substat guarantee works?