求平均抽取几次可抽到一把SSR武器

抽取 ssr 武器的概率为 2%,累计 50 次未抽到 ssr 武器后,从第 51 次开始每次抽取到 ssr 武器的概率提升 5%,直到抽到任意 ssr 武器后重置次数及概率。求平均抽取几次可抽 到一把 ssr 武器。
使用MATLAB进行10亿次仿真,求得平均次数为33.5981,向上取整为34次。MATLAB代码如下。
MATLAB代码:
begintime = datetime
count_sum = 1e9;%总人数
ori_pos = 0.02; %original possibility
pos_add = 0.05;
thres = 50;
count = 0;%人数
times = zeros(1,count_sum);%次数
pick = 0;%中ssr人数
flag = 0;%0:没拿到ssr 1:拿到了ssr
while( count < count_sum )
while( times( count + 1 ) < 50 && flag == 0 )
tmp = rand();
if(tmp < ori_pos)
pick = pick + 1;
flag = 1;
end
times( count + 1 ) = times( count + 1 ) + 1;
end
while( flag == 0 )
tmp = rand();
cur_pos = ( times( count + 1 ) - 50 + 1 ) * pos_add + ori_pos;
if( tmp < cur_pos )
pick = pick + 1;
flag = 1;
end
times( count + 1 ) = times( count + 1 ) + 1;
end
flag = 0;
count = count + 1;
end
endtime = datetime
mean(times)