random number generator to two different variables
5 ビュー (過去 30 日間)
古いコメントを表示
I want to initialize two different random numbers to be assigned to different variables. If I put in:
x_1 = rand x_2 = rand
they will get exactly the same number. How do I assign two different random numbers?
Thanksr
0 件のコメント
採用された回答
Shane
2014 年 11 月 25 日
They get different random numbers for me. Which version of Matlab are you using?
4 件のコメント
Shane
2014 年 11 月 25 日
You may look into this: http://www.mathworks.com/help/matlab/math/why-do-random-numbers-repeat-after-startup.html
その他の回答 (1 件)
Peter Perkins
2014 年 11 月 25 日
cgo, it may be that you have created a variable called "rand" in your workspace that is shadowing the rand function. The rand function does not return the same value two times in a row within the same MATLAB session.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Random Number Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!