question

weiiiii avatar image
0 Likes"
weiiiii asked weiiiii commented

create random number

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

FlexSim 20.0.10
random
1690263024865.png (16.0 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered weiiiii commented

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.

· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Felix Möhlmann avatar image Felix Möhlmann commented ·
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;
1 Like 1 ·
weiiiii avatar image weiiiii Felix Möhlmann commented ·

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

0 Likes 0 ·
weiiiii avatar image weiiiii commented ·

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

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.