Returns a random number.

 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.


{if random() < .3} 
<p>There is a 30% chance that this section will appear in the message.</p> 

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.


{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.