Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Random Number Generator

Rhane
Kilo Explorer

I am looking to create a 4 digit random number generator for a variable. Is there a specific variable type I should use? Right now I have single line variable and when I put the below script in the default value, it generates the number but there is a decimal behind it.
javascript: Math.round(Math.random()*9000) + 1000;

Could anyone answer how to truncate the decimal and what is behind that? Or if there is an easier way to make a random integer pop up in a variable?

Thanks in advance.

5 REPLIES 5

How can I make sure, that this random vlaue will not be duplicated or repeat it self ?