[問題] randint

看板MATLAB作者 (s1110608)時間10年前 (2014/04/15 11:13), 編輯推噓0(003)
留言3則, 2人參與, 最新討論串1/1
請問如果我要用randint產生某兩個數的亂數 例如1跟3 randint(1,10,[1 3]) 要如何才能避開中間的2呢? 有沒有比較簡單的方法呢 謝謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.117.163.52 ※ 文章網址: http://www.ptt.cc/bbs/MATLAB/M.1397531601.A.5CA.html

04/15 11:22, , 1F
randint(1,10,[0 1])*2+1
04/15 11:22, 1F

04/18 21:28, , 2F
盡量不要用randint 速度很慢 某版後就不支援了
04/18 21:28, 2F

04/18 21:30, , 3F
round(rand())
04/18 21:30, 3F
文章代碼(AID): #1JJAFHNA (MATLAB)