question

weiiiii avatar image
0 Likes"
weiiiii asked Julie Weller commented

assign a random number label

我想設置一個隨機數並在後面的延遲和代碼中使用它,所以使用分配標籤創建隨機數標籤

I hope that I can generate different random numbers every time I run the "source", so I want to set up a label

I try to use assign label


1690267833618.png

隨機數為 1 到 100


1690267914923.png

但現在我的隨機數將根據123......

1690267957364.png

如何編寫生成隨機標籤?或者有更好的寫法嗎?

But the result is produced in order

FlexSim 20.0.10
randomassigntoken
1690267833618.png (24.7 KiB)
1690267914923.png (50.4 KiB)
1690267957364.png (15.8 KiB)
· 2
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

You should be adding getstream(activity) or getstream(current) to the uniform parameters as a 'good habit'

0 Likes 0 ·
Julie Weller avatar image Julie Weller commented ·

Hi @weiiiii, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered

The code to assign a random number to the token label is correct. Though you can also type the distribution directly into the Value field. There is no need to edit the code directly in this case.

1690275742028.png

What you are looking at in the last screenshot are the statistics of the Assign Labels activity - how many tokens have entered and exited the activity. It has nothing to do with the assigned label value.


1690275742028.png (4.5 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.

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.