For a current project I had to take an array of images and make one randomly appear at the top of my page. On refresh or a different page, an image would be picked at random and displayed. It had to be something lightweight and I found one that did what I was asking for without any snags.
* Name your images 1.jpg, 2.jpg etc.
To get this to work in a WordPress template you have to concatenate get_template_directory_uri() at the beginning of the file location, unless you want to put the exact URL in (which makes it hard for local testing and then the switch to a server).
This isn’t necessarily the optimal way to do this as you have to name all of your images 1-whatever number you put as your $total, but it is a quick way to get a random image in your WordPress site.