API question; randomizationPosted on: 06/08/25 04:55PM
Hi.
I wanted to be able to pull X amount of random images for a given tag set. Is there a built in method for that? In my Googling I saw someone reference a random function but they complained it was blank, and it still is. So far what I came up with is basically do an initial query on the tag set and get the count attribute from the posts parent. Then I can loop on the number of images needed and in the loop set int chosen to random between 0 and Math.Max(count attribute, 20000). Then I just get pid chosen limit 1, then sleep for a little to prevent hammering on the server.
I guess that'd work, but it'd be way nicer to be able to do like &tags=whatever&limit=6&random or something. Is there something like that?
Thanks!