random
Description
Returns a random number.
Copy
float random( [ integer limit ] )
If called with no parameters, returns a floating-point number between 0.0 and 1.0.
If called with a single parameter, an integer, returns an integer between 0 (inclusive), and that number (exclusive). So for example, random(8)
returns an integer in the range 0-7.
Example
{if random() < .3} <p>There is a 30% chance that this section will appear in the message.</p> {/if}
Randomly Select Subject Lines from Content Feed Titles and Test Performance
Use Case: If you have ten pieces of content in a data feed, generate a random number between 0-9 to randomly assign a subject line to users in order to see which performs best.Zephyr:
{randNum = random(10)}
{subjectLine = content[randNum].title}
Then, check the Campaign Summary Page to see which performed best!
Explanation: This script creates a local variable (called “randNum”), which equals a randomized value between 0 and 9 (this value will randomize for each user). Separately, the “subjectLine” assignment references that number in order to randomly pull in one of the content array’s titles to act as the subject line.