I am considering a homebrew rule that would give players the option on leveling up to re-roll all of their hit dice (excluding their first level) instead of only rolling their new hit die when determining their maximum hit points.
For example a Wizard levels up to level 3. When they leveled up to level 2 they rolled a 2 and they have +0 CON so they had a maximum hp of 8. Instead of rolling their new hit die for possible outcomes of 9-14 hp they can choose to also re-roll their level 2 hit die for possible outcomes of 8-18.
I have been trying to figure out how this would affect average hp outcomes at different levels but I only play with probabilities as a hobby and I am having issues with the math once it gets to higher levels.
How would allowing players to re-roll all hit dice when leveling up affect average hp, assuming that players will always re-roll if their former max hp was below average?