@RANDFILE — Picks a file at random and returns its filename.

Syntax:
%@RANDFILE[/A:attribs /S /[range] wildspec]

wildspecrequired; directory aliases are supported
/A:attribsfilter by attributes; use /A:D to find subdirectories instead of files
/Ssearch for matching files in subdirectories
/[range]many range options are supported
wildspecrequired; directory aliases are supported

@RANDFILE makes a list of files matching the given wildspec, picks one at random, and returns a complete pathname. If no files match the wildspec, this function returns an empty string.

•  Note: Enumerating all matching files can take a long time, especially if you use /S.