Hi to Xavier and the ForeUI team,
I need to create a random number in my prototype. I've been trying to hack it by embedding a JavaScript Math.rand() function in a conditional, but I must not be doing it right.
What would be the best way to create a random number?
Thanks,
David Hoard
I need to create a random number in my prototype. I've been trying to hack it by embedding a JavaScript Math.rand() function in a conditional, but I must not be doing it right.
What would be the best way to create a random number?
Thanks,
David Hoard
 33 Posts
 1 Reply Like
 puzzled
Posted 6 years ago
ViVi, Official Rep
 829 Posts
 57 Reply Likes
Official Response
Hi David,
You should use the Math.random() function to generate the random number, it returns a decimal between 0 and 1. Here is an example of this kind of usage http://www.foreui.net/node/76
Also you can use the expression below to calculate a random number:
number = seed * 29 + 39
Where the seed can be the current second in global properties. Also here is an example http://www.foreui.net/node/64
You should use the Math.random() function to generate the random number, it returns a decimal between 0 and 1. Here is an example of this kind of usage http://www.foreui.net/node/76
Also you can use the expression below to calculate a random number:
number = seed * 29 + 39
Where the seed can be the current second in global properties. Also here is an example http://www.foreui.net/node/64
Related Conversations
How to creat a new global property during simulation?
 Yasofies Urason, 4 years ago
 Last reply: Yasofies Urason, 4 years ago
 1
 2
 Question
How to create a pie menue with single elements clickable?
 black.medidot, 6 years ago
 Last reply: black.medidot, 6 years ago
 1
 2
 Question
How do I create a larger canvas area to work with?
 Jessica Anderson, 2 years ago
 Last reply: ViVi, 2 years ago
 1
 1
 Question
 Answered
How to create proper lines in Hand Drawing and Wire Frame themes?
 Erinah, 5 years ago
 Last reply: Erinah, 4 years ago
 1
 5
 Question
Related Categories

ForeUI
 907 Conversations
 11 Followers