rand returns me the same numbers on Simulink?

2 ビュー (過去 30 日間)
Teng Da Wen
Teng Da Wen 2020 年 6 月 23 日
コメント済み: Teng Da Wen 2020 年 6 月 23 日
Hello,
I'm making a simulation of how much time is required for an Item to get through some Workstation, and I wanted to give some kind of randomness to worktime, I tried by using a Matlab action service time source, and having a minimum Worktime on which is added the max delay the station can have multiplied for a rand(1) function (as shown below).
However running the simulation multiple times I noticed the value of service time that is returned is always the same, what am I doing wrong? how should I solve it?
Thanks in advance

採用された回答

Reeshabh Kumar Ranjan
Reeshabh Kumar Ranjan 2020 年 6 月 23 日
Hey Teng,
See if it solves your problem.
  1 件のコメント
Teng Da Wen
Teng Da Wen 2020 年 6 月 23 日
Ye it was it, I solved this by adding this line of code, Actually I had already tried with rng('Shuffle') but it didn't work, then I found out on simulink I need to declare the function as an exstrinsic one, thanks.
coder.extrinsic('rng');
rng('shuffle')

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDiscrete-Event Simulation についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by