powered by
which.max() with random at ties
which.max.random(x)
Index of maximum value in x, with random tie-breaking.
A numeric vector.