Requesting a game from the site at random? Can it be done?

Avatar image for windmill1158
windmill1158

2

Forum Posts

0

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#1  Edited By windmill1158

Been poring over the API docs and can't find any call that will allow me to request a random game. I'm avoiding creating a local copy of the entire games list with images and links for the sake of processing speed and would much rather make one request at a time in random order.

Has anyone here tried something like this?

Avatar image for hach
hach

253

Forum Posts

5

Wiki Points

0

Followers

Reviews: 0

User Lists: 0

#2  Edited By hach

you might be best served generating a random number within the ID range of the games resource and requesting by ID, if that turns out to be too much trouble you could create a local copy of just the guids which should be much more doable, and then pick a random one and do a single request.

edit: seems like you can search by date added, could do something like getting the latest added games id, generate random between 1 and that number and request by that id, and do a rate limited retry in case of id not found. Unless the db ids are very sparse should average at 2 calls per random game, and less if you're willing to cache the latest id for a period of time