Randomly displaying content on a page?

Hi all

I'm writing a synopsis for a course and wonder if there is a way to randomly display some content on a screen (not in a quiz).

Say I have three different examples in some layers and I want that each time a user returns to the course it displays a layer randomly chosen by the system. Is this doable?

Thank you.

4 Replies
Alexandros Anoyatis

Hi Helene and Pam,

There are at least a couple of ways to do this, one of which (the "cleaner" one) involves JavaScript.

You can use math.random with a JavaScript trigger to do this ( see the last example mentioned in Articulates best javascript practices document for more info ).

This will involve the following steps :

1) Create a numerical variable (say layervalue).

2) Create a trigger which will execute Javascipt when timeline of your slide starts (the JS should contain code that picks a random number between 1 and the number equal to the number of layers you have on the slide).

3) Create a listener that jumps to layer 1 when layervalue changes if value of layervalue==1, and so on...

Hope this helps,


Steve Flowers

I was thinking along the same lines as Alex. JavaScript is the most elegant way to do this in Storyline.

However, I think there's another way to do this if you consider the amount of time a participant spends idle as "random". See the attached file. This uses four layers in a master slide to rapidly sequence in a loop while on the first slide. Each layer sets the number to 1, 2, 3, or 4. The final value is set when the participant exits the slide. It takes a second to run through the full sequence. Unless the participant has impeccable timing, this produces the effect of randomness.