Re: [討論] 有關rand(1)和rand(100)的差別

看板MATLAB作者 ( )時間10年前 (2014/11/26 12:29), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/4 (看更多)
做個實驗就可以確定是一樣的 但要注意 Matlab 是 column major 使用小一點的矩陣(例:2x2)也可以直接觀察出來 - - rng('default') % 重設 random seed A = rand(100); rng('default') % 重設 random seed B = zeros(100); for colIdx = 1 : 100 for rowIdx = 1 : 100 B(rowIdx, colIdx) = rand; end end all(A(:) == B(:)) -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.43.105.221 ※ 文章網址: http://www.ptt.cc/bbs/MATLAB/M.1416976169.A.5C2.html
文章代碼(AID): #1KTLSfN2 (MATLAB)
文章代碼(AID): #1KTLSfN2 (MATLAB)