Pick a random file from a directory tree
If we rewrite your code to take advantage of Pathlib, we get the following:

import os
import sys
import random
from pathlib import Path


def get_random_files2(ext, top=os.getcwd()):
    file_list = list(Path(top).glob(f"**/*.{ext}"))
    if not len(file_list):
        return f"No files matched that extension: {ext}"
    rand = random.randint(0, len(file_list) - 1)
    return file_list[rand]


if __name__ == '__main__':
    extension = sys.argv[1] if len(sys.argv) &gt; 1 else "*"
    print(get_random_files2(extension))


I appended a "2" to the function name in my example just to make it easier to copy/paste if you want.
The benefits of using Pathlib is that we can glob directly from the path object, and it will recursively get a list of files throughout the tree.

I noticed your code only works with os.getcwd() so there was no point in injecting two parameters into get_random_files. However, I left the function signature the same in case you want to enhance it later. 

The looping seemed out of place when (a) you want to check for files (b) you want a random file. So, the code gets the files or returns "No files found", and if it finds some files, picks one of them from the list of files.
Please take some time to understand the approach I used. The biggest take-aways you can have are: 


Infinite loops are bad (the while True:) unless you really, really need them (because you don't want to write event-based code or you just want to block), 
Looping is always slow,
Modifying variables inside loops is bad (your construction/approach is faulty when you modify variable content when those variables control or affect the functionality or processing of what your code is actually doing),
if you're going to use random values, it's best to understand why you're doing that. If it's to pick from a list, ensure you populate the list first, don't rely on the random value to dictate your actions.
Look at keeping functions to 4 or so lines - because this will ensure you adhere to the Single Responsibility principal, which makes your code better in the long run (less support and maintenance).


Otherwise, a good attempt at automation. Keep it up and post more of your code when you have it.