TruClient Web - How to select a random action?

Within the truclient interface I have a group of actions that are grouped together into a For...Next loop and want to randomly select one of the actions to execute. Is there a way to do this in the native TruClient interface or do I need to switch to a code-based TruClient script?

  • Hi,

    You can add an "If Block" from the Toolbox and surround any step you wish. Write JavaScript code with some randomization logic to ensure the If step condition is true randomly.

    Regards,

    Shlomi

     

  • I implemented Shlomi's way to select random step. 

    1. Drag and drop javascript and add below code.

    var i;
    i=Math.floor((Math.random() * 3) 1);

    //change the number 3 into number of steps you have in the for loop.

    2. In For loop, change the variable from i to j

    3. Surround each step inside For Loop by if condition and add the condition for each if step as shown below.

    https://cl.ly/q4Un