Skip to main content
Solved

Modulo - Generating a Random Number

  • July 30, 2022
  • 1 reply
  • 188 views

Forum|alt.badge.img+2

Hiya, 

Is there anything like Modulo in Klaviyo/Django?

Something like this:

{% capture timeSeed %}{{ 'now' | date: "%s" }}{% endcapture %}{% assign random = timeSeed | modulo: 3 %}

The code uses the time to create a random number.

Thanks for your help.

Best answer by Dov

Hi @autotim,

Thanks for sharing this question with us.

We currently don’t have the ability to generate a random number using the time.

Perhaps you can elaborate on the use case a bit further (what are you using the number for and if it needs to be based on time or can be truly random?) and we can look to find a viable alternative.

Thanks for being a community member.

 

 

1 reply

Dov
Forum|alt.badge.img+61
  • Klaviyo Alum
  • 1493 replies
  • Answer
  • August 1, 2022

Hi @autotim,

Thanks for sharing this question with us.

We currently don’t have the ability to generate a random number using the time.

Perhaps you can elaborate on the use case a bit further (what are you using the number for and if it needs to be based on time or can be truly random?) and we can look to find a viable alternative.

Thanks for being a community member.