Assuming you know the folder where the files are located and that the files are PHP files:
$phpFiles = glob('/path/to/files/*.php');
if (empty($phpFiles) === false)
{
$randomFile = $phpFiles[array_rand($phpFiles)];
include($randomFile);
}
a source
to share