Problem about random image

Hello! I have a problem with my app, i initialize an app , i put the variable and when i tell the app to show me a random image from that app, sometimes is not working, it shows only 1 image from 2 how i set it. Can somebody help me with that?