Please take a moment to look at this page: Using code tags properly
It will show you how you can post your code on the forums, so that it’s formatted and much nicer for others to read
Your code looks mostly good. Here are a couple of things to get it working, I think.
- Change the method to “public void ShowRandomImage()”
- in the inspector for your button, there is an “OnClick” event you will see. First, click the ‘+’ sign to add a new event. Then, drag the game object that has this script on it, to the game object slot. (Make sure you drag from the scene, and not assets, if it’s also a prefab.). Now, you will use the drop down menu there to choose this script, followed by selecting the method to change the image.
- run the game and click the button and see if it works
Some good, and helpful introductions: