generate same random matrix in another computer..

8 ビュー (過去 30 日間)
Abhishek sadasivan
Abhishek sadasivan 2014 年 9 月 12 日
コメント済み: Abhishek sadasivan 2014 年 9 月 13 日
Hai ..I have a doubt ,whether it is possible to get same random matrix in another computer where same matlab software is installed . consider A= rand(2,3) when I entered this in my computer in home .I got A= 0.8147 0.1270 0.6324 0.9058 0.9134 0.0975 I would like to send A matrix to my computer in my office.Instead of sending the full matrix A ,I would like to generate the same random matrix in my office ..whether it is possible ???..

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 9 月 12 日
Use rng
rng(10)
rand(4)
  1 件のコメント
Abhishek sadasivan
Abhishek sadasivan 2014 年 9 月 13 日
thanks ..I got it..

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

その他の回答 (1 件)

Guillaume
Guillaume 2014 年 9 月 12 日
random number generators are not really random, they just generate a sequence of numbers that appear random using formulas based on an internal state. If you set the same internal state the formula give you the same number.
Normally, you do not want the number generation to be reproducible, so you initialise the state with something unpredictable, like the current time but you can also initialise it with a fixed state. You use rng to initialise the state, Thus start your program on both computers with
rng(any_positive_number_of_your_choosing)
  1 件のコメント
Abhishek sadasivan
Abhishek sadasivan 2014 年 9 月 13 日
Thanks ..I got it

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

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by