Re: [問題]關於用matlab產生威力彩號碼

看板MATLAB作者 (RL)時間14年前 (2011/12/28 18:16), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串2/2 (看更多)
row=1e5; x=zeros(row,6); for i=1:row for j=1:6 x(i,j)=rand(1); end end x=ceil(38*x); t=zeros(1,38); for n=1:38 t(n)=length(find(x==n)); end disp(t) ------------------------------------------------------ Columns 1 through 4 15847 15662 15823 15795 Columns 5 through 8 15497 15792 15588 15629 . . . Columns 33 through 36 15650 15832 15893 15968 Columns 37 through 38 15817 15822 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 125.231.39.215 row=1e5; Num=zeros(row,6); x=zeros(row,6); for i=1:row x=rand(1,38); [~,b]=sort(x); Num(i,:)=b(1:6); end t=zeros(1,38); for n=1:38 t(n)=length(find(Num==n)); end disp(t) --------------------------------------------------------- Columns 1 through 4 15876 15865 15746 15533 Columns 5 through 8 15572 15578 15690 15839 . . . Columns 33 through 36 15775 15811 15809 15723 Columns 37 through 38 15806 15838 ※ 編輯: Rasin 來自: 125.231.39.215 (12/28 18:42)

12/28 18:43, , 1F
跑了數次覺得滿正常的 各次數並沒有偏大或偏小的問題
12/28 18:43, 1F
文章代碼(AID): #1E-kngFa (MATLAB)
文章代碼(AID): #1E-kngFa (MATLAB)