If the XPath expression will not change from one call to another, and the input source will also be the same, then you will need to provide variance with parameterization, otherwise with the same function with the same input, the same result will always be output (that's why I made a comment on declarative paradigm).
Sort of:
/table[@id='mytable']/tbody/tr[$pseudoRandom mod count(../tr) + 1]
If the source source has one estimate, the simplest pseudo-randomness in XPath will be
/table[@id='mytable']/tbody/tr[count(//node()|//@*) mod count(../tr) + 1]
, .
user357812