True Random for CMS Items

Hey there. I would like to achieve true random for a collection. It’s for native ads that run on our website. We partner with local businesses and groups to run ads on our news website. I want the collection to be random every time, not just every 12 hours when the cache refreshes. You can see examples of our banner and square ads on at the read only link.

I assume I’ll need some custom code to achieve this. Please advise!

Here is my site Read-Only: LINK

Did you ever find a work-around?

The only way to do this without leveraging an external API that could return randomized data would be to hide the collection list output on the page that contained the data to randomize it. One way is to convert that to a JavaScript array, randomize the array and return a single result . Of course this requires custom code but there are plenty of examples online if you know where to look.

Here is a resource that can help you solve the problem => How to Randomize (shuffle) a JavaScript Array