Streaming live at 10am (PST)

Randomly select a div


Hi all;

What is the recommended way if I want to have 4

elements, and it randomly selects one of them to display? The purpose is we have 4 widgets that show our reviews on 4 different review sites. On our web pages we want to randomly display one of them.

thanks - dave


If you’re using the CMS, you can have the widget as CMS items, display them in a Collection list that is set to show 1 item, and set the sorting to random.


That’s a very clean way to do this - thank you


I’ve never had to use the random value for sorting myself. @zbrah used it when it came out and if I recall correctly, the randomness wasn’t for each refresh of the page, rather once every day or every… hours? I don’t recall precisely and don’t know if it changed since. But anyway, even with a new pick everyday, you get the effects you’re after, I think, unless you really want to spread the outgoing traffic in real time.


We want random between pages, but it’s fine if it’s consistent on a specific page. So this should work fine as long as the value is unique to each page (using the same symbol that contains this).

Is it?


I made a test the random is not on any refresh.

Random is not like saying Unique to each page (If you role fair six dice - the dice is random but you can get the same number twice in 1/36 chance). In your case the chance is 1/16 (1/4 * 1/4). Anyway @vincent idea is the best solution her (Mark as solution i think :slight_smile: )


Hey @vincent @David_Thielen random occurs every 24h because of the CDN.
Hope this helps,