I am new at JS and am trying to create a random picture each time the function occurs. Right now if I use a lorem pixel my functions all have same picture. Here is my JS div code:
For generating a randomIndex, Math.floor() and Math.random() are your friends.
(Info on generating random numbers in Javascript: https://www.w3schools.com/js/js_random.asp)
If you want to do the array method instead of using the endpoint, you can check the current random index against the last random index and run the get random index code again if they are the same.