function dice_diff = loln(N)add = 0; mean = 0; mean1 = 0;add1=0;for c=1:1*exp(8) num = randi(N); add = add + num;endmean = add/(1*exp(8))for c=1:N add1=add1+c;endmean1=add1/N dice_diff = mean-mean1end
The code works fine but the result is not as expected. Could anyone tell the reason?
Best Answer