def get_random_image(img_dir):
images, current_wall = get_image_dir(img_dir)<EOL>if len(images) > <NUM_LIT:2> and current_wall in images:<EOL><INDENT>images.remove(current_wall)<EOL><DEDENT>elif not images:<EOL><INDENT>logging.error("<STR_LIT>")<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>random.shuffle(images)<EOL>return os.path.join(img_dir, images[<NUM_LIT:0>])<EOL>
Pick a random image file from a directory.