To further complement the existing answers, you certainly can implement your "reroll lowest and take middle" mechanic literally in AnyDice, e.g. like this:
function: reroll lowest of DICE:s as REROLL:n and take middle {
\ Start with the reroll die: \
NEW_DICE: {REROLL}
\ Add all of the original dice except the lowest: \
loop POS over {1 .. (#DICE - 1)} {
NEW_DICE: {NEW_DICE, POS @ DICE}
}
\ Sort the resulting new dice (from highest to lowest): \
NEW_DICE: [sort NEW_DICE]
\ Return the middle roll: \
MIDDLE_POS: (1 + #NEW_DICE) / 2
result: MIDDLE_POS @ NEW_DICE
}
output [reroll lowest of 3d10 as d10 and take middle] named "middle of (3d10 reroll lowest)"
However, if you compare the output of this program with just a straight 2@(4d10)
(i.e. second highest of 4d10) roll, you can see that they're exactly identical!
Why? Well, your rolling mechanic effectively works like this:
- Roll 3d10.
- Drop the lowest roll.
- Add one more d10 roll.
- Take the middle roll.
Now, what if we reverse the order of steps 2 and 3? That is, what if we first roll 3d10 and then add one more d10 (effectively just rolling 4d10) and then drop the lowest roll before taking the middle roll (effectively just taking the second highest roll out of 4)?
Well, if the extra d10 we add in step 3 turns out to be higher than (or equal to) the original lowest roll dropped in step 2, then reversing the order makes no difference at all: we drop the same roll anyway, whether we do it before or after adding the extra roll.
On the other hand, if the extra d10 we add in step 3 ends up being lower than the original lowest roll dropped in step 2, then reversing steps 2 and 3 causes us to drop it instead of the original lowest roll. But in that case neither of the rolls was going to be selected in step 4 anyway, so it doesn't matter which one we drop!
So, either way, it doesn't matter whether we add the extra d10 or drop the lowest roll first. All that can change is the value of the lowest of the three remaining rolls, and we're not selecting that roll anyway.
(The same argument, mutatis mutandis, also shows that rerolling the highest of 3d10 and the taking the middle roll is equivalent to taking the second lowest of 4d10, i.e. 3@(4d10)
in AnyDice notation.)