Journey optimizer math functions
The Journey Optimizer functions, random
and round
, are essential tools for data processing and management within journey-related tasks. These functions are beneficial for data engineers and architects who need to perform mathematical operations efficiently.
Example usage
Suppose you want to assign a user to one of two groups randomly within a journey. You can use the random
function to generate a random number and decide the group based on this number:
let groupAssignment = random() < 0.5 ? "Group A" : "Group B";
This example shows how to utilize the random
function to ensure users are distributed evenly between two groups.
Function
Description
Syntax
Parameters
Returns
Example
Random
Produces a random number between 0 and 1.
random()
None
decimal
-
Round
Converts a number to its nearest integer, with ties rounding up.
round(<parameters>)
decimal, integer
integer
round(3.14)
returns 3
recommendation-more-help
91a6d90a-6d61-4a62-bbed-ae105e36a860