Another idea could be to fill a random number with always 5 digits with
$num($rand(),5)
The randomness seems to be improved since v3.13, but I would not garantuee if you use this function for lets say 99999 tracks that you never get a duplicated number. I could not find a way to tell this function to generate a value with 6 or more digits - maybe you could fill your user defined tag like this:
$num($rand(),5) - $num($rand(),5) - $num($rand(),5)
As long as this duplicate doesn't appear for the same folder it should not be a problem.