Re: [問題]關於用matlab產生威力彩號碼
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
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):