用蒙特卡洛模拟:
N=10000 %试验次数,越大越精确
C=zeros(N,1); %存储每次试验的结果
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%开始试验
for k=1:N
%按A的密度分布对A抽样
r=rand; %产生一个服从U(0,1)的随机数;
if
用蒙特卡洛模拟:
N=10000 %试验次数,越大越精确
C=zeros(N,1); %存储每次试验的结果
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%开始试验
for k=1:N
%按A的密度分布对A抽样
r=rand; %产生一个服从U(0,1)的随机数;
if