When hydrogen and oxygen reacts, what defines if it will turn into hydrogen peroxide or water?

If you have a jar with oxygen and hydrogen inside, I'm interested in knowing what variables are most important to ensure that the mixture will become water (if that was the goal) or hydrogen peroxide, but not both. I understand that at room temperature those two gases will not react to form anything, so the question is more about the details of how the mixture could be manipulated to take a route to become X vs Y.


