Matlab random numbers generator is repeating itself

9 ビュー (過去 30 日間)
Konrad Witt
Konrad Witt 2018 年 4 月 22 日
コメント済み: Konrad Witt 2018 年 4 月 23 日
Dear Matlab Community, I am currently working on a problem, which can be simplified to such a summary: generate a set of random numbers, check if these random numbers meet a specified condition, if they do - save them, if they don't - generate next set of random numbers. I need to find thousands of these "fitting" sets of random numbers. Usually it takes about 20-50 random generations untill the condition is finally met, but sometimes what happpens is that no number can be found and the search continues for milions of iterations and never ends. Usually what helps is "ctrl+c" and starting the program again, but it's very annoying. I've been using 'randi' and 'rand' functions and I've been trying to solve the issue with rng('shuffle') or trying out diffrent rng generators - none seems to be working, I finally come to a point, where the search of numbers fitting my conditions continues untill reseted. Hopefully someone has been struggling with similar problem in the past and can share a solution.
  3 件のコメント
the cyclist
the cyclist 2018 年 4 月 22 日
編集済み: the cyclist 2018 年 4 月 22 日

Based on the information you have presented, my best guess is that your "specified condition" is not something that (pseudo)randomly generated numbers should actually meet. Can you be more specific about that?

The MATLAB generator is extremely high quality.

Konrad Witt
Konrad Witt 2018 年 4 月 23 日
Minutes after posting the question I realized the problem and you were right. The conditions to meet were partially influenced by a random factor and in some cases - meeting the conditions was impossible. Thank you for answers.

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

回答 (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