0

Generating a random number with Klipfolio functions.

Many times we need a random number to be generated between a specific range. Using Javascript to do that is tricky since we cannot set that randomly generated number on the dashboard. 
So you can use the following expression to generate a random number between high and low using the current time in Klipfolio.

moment % (hi - lo + 1)

 In Klipfolio to get the current time you can use NOW(), and then use the MOD function for the % modulus operator. 

MOD(NOW(),(high-low+1)

e.g. 

ROUND(MOD(NOW(),(1.1-0.9+1)),2)    

I used ROUND to truncate my results. 

I hope that helps. 

Cheers!

The Data Girl! 

0 comments

Please sign in to leave a comment.