Are these two methods of handling Elven Accuracy “Double Advantage” mathematically equivalent?

For context, part of the Elven Accuracy feat (Xanathar’s Guide to Everything, p. 74) states:

Whenever you have advantage on an attack roll using Dexterity, Intelligence, Wisdom, or Charisma, you can reroll one of the dice once.

So the obvious way to handle this, mechanically, is to roll two dice, pick the lowest, and roll it again. But as an effort to save time, I’ve proposed instead simply rolling three dice simultaneously, and picking the highest rolled value.

The problem is that I’m not certain that this is mathematically correct.

I created a code simulation that was intended to model the probability curve of both methods, and it suggests that the two methods are mathematically equivalent, but the simulation only performs direct sampling of random numbers and their results; it has unavoidable error in the results, and it doesn’t attempt to solve the underlying mathematical principles involved.

//Roll 3, pick highest ResultSet: Double Advantage      Average: 15.48246                                                                                                      Variance: 14.94721234837884                                                                                            Std. Deviation: 3.8661624834425727                                                                                     95% range: [6, 20]                                                                                                     Mode: 20                                                                                                               Median: 16         //Roll 2, reroll lowest, pick highest ResultSet: Alternate Double Advantage                                                                                      Average: 15.488486                                                                                                     Variance: 14.944649427739675                                                                                           Std. Deviation: 3.8658310138623073                                                                                     95% range: [6, 20]                                                                                                     Mode: 20                                                                                                               Median: 16             

Is it correct to say that these two dice-rolling methods are equivalent, or should I stick to the RAW interpretation of how these dice should be rolled?

For full context, I’m planning out a build for a Shadow Sorcerer that fights only in melee combat, and if this character has the ability to nearly-permanently shroud themselves in Darkness (which is one of their class features), it’ll give them nearly permanent Advantage against creatures that don’t have Devil’s Sight or Truesight (or a reliable, spammable Counterspell/Dispel Magic). So simplifying this roll can matter in terms of time saved.