randperm not working correctly on Matlab Web App

1 回表示 (過去 30 日間)
Marcos 2021 年 3 月 12 日
コメント済み: Marcos 2021 年 3 月 13 日
Hello everyone,
I have a problem with the randperm function. In the MATLAB App designer it always outputs a random number, but in the Web App the numbers are always the same. Is that the expected behavior? May I be missing something?
  3 件のコメント
Marcos 2021 年 3 月 12 日
No, I haven't! Should I use the rng seed function with a specific parameter?
Cris LaPierre
Cris LaPierre 2021 年 3 月 12 日
No, but if you are using it, it will cause the same random numbers to be generated each time.



Steven Lord
Steven Lord 2021 年 3 月 13 日
I believe that each instance of the Web App is or is equivalent to a new session of MATLAB. In that case this documentation page applies. Follow the instructions it gives to generate random numbers that are different each time.
  1 件のコメント
Marcos 2021 年 3 月 13 日
Yes, actually I have managed to solve the problem using rng('shuffle') before each call of randperm. I think that the problem was with how the server manages the sessions.
Thank you all for your replies!


その他の回答 (0 件)


Help Center および File ExchangeMATLAB Web App Server についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by