필터 지우기
필터 지우기

generate same random matrix in another computer..

조회 수: 2 (최근 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개)

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)

카테고리

Help CenterFile Exchange에서 Signal Attributes and Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by