Randperm same sequence each time you run the code

6 ビュー (過去 30 日間)
Stef
Stef 2018 年 5 月 26 日
編集済み: Ameer Hamza 2018 年 5 月 26 日
Is there a possibility to have each time the same random permutation when you run the code to make results comparable?
randperm(length(X))
I want to have the random numbers in the same order everytime the code is run.

採用された回答

Ameer Hamza
Ameer Hamza 2018 年 5 月 26 日
編集済み: Ameer Hamza 2018 年 5 月 26 日
See the random number generator with the same number. For example, add this line before running randperm()
rng(5); % you can use any number instead of 5

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRandom Number Generation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by