As for the unlikely but possible chance of getting the same link twice in a row, you could create a small array of the last few links generated, and tell the function to choose a new random link if it matches any link in the array. This array would also allow for some additional functionality (like an ‘oops’ button allowing you to go back to the last link when you’ve accidentally clicked to generate a new link when you saw one you were interested in.) Maybe that’s a bit more than necessary, or maybe you could expand on that a little further even. JM2C
I like this idea. I think I’d prefer to do it on the client even if it’s +1 request (rarely) as you described.
I like the state idea too, the ‘oops’ button is cool 👍
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.