create random number

create random number

weiiii
Not applicable
297 Views
4 Replies
Message 1 of 5

create random number

weiiii
Not applicable

[ FlexSim 20.0.10 ]

I want each run to generate a random number from 0 to 1

I tried it in the script first, but the random numbers that came out were all 0


1690263024865.png

0 Likes
Accepted solutions (1)
298 Views
4 Replies
Replies (4)
Message 2 of 5

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

How often did you hit run script button, the green arrow? Once, twice?
And did you open the output console from debug main menu, because there prints the script your result.

Message 3 of 5

moehlmann_fe
Advocate
Advocate
To add to this: The number in the Value field is the return value of the code you execute in the script console. You don't return any value so it defaults to 0.

To have the random number show up, use

return numberRandom;
Message 4 of 5

weiiii
Not applicable

謝謝!!我以為打印會直接顯示在那裡

0 Likes
Message 5 of 5

weiiii
Not applicable

謝謝!我嘗試了你的兩種方法,它顯示了

0 Likes