generate same random matrix in another computer..
8 次查看(过去 30 天)
显示 更早的评论
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 ???..
0 个评论
采纳的回答
更多回答(1 个)
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 Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!