The expected value is the average of a large number of experiments. This is just a single experiment. The reason why you get 0 several times is because the variance is very large, and the results are mainly distributed between large numbers and 0. The probability that the result is not 0 is the probability that 0 does not appear among 100 random numbers. This is 0.9 raised to the 100th power, which is about 0.000026. According to the theorem of large numbers (or some other theorem), this semester’s mathematical statistics and probability theory Hang up
Your random number is correct, there is something wrong with your program. In your y*=x line, as long as one x randomly reaches 0, the final y will be 0. If you loop 100 times, x will definitely reach 0 randomly. This is elementary school multiplication problem, classmate
I suggest you take another look at the Theorem of Large Numbers. The hundred times you have here are just one experiment, and you need an outer loop. . .
The expected value is the average of a large number of experiments. This is just a single experiment. The reason why you get 0 several times is because the variance is very large, and the results are mainly distributed between large numbers and 0. The probability that the result is not 0 is the probability that 0 does not appear among 100 random numbers. This is 0.9 raised to the 100th power, which is about 0.000026. According to the theorem of large numbers (or some other theorem), this semester’s mathematical statistics and probability theory Hang up
Your random number is correct, there is something wrong with your program. In your
y*=x
line, as long as one x randomly reaches 0, the final y will be 0. If you loop 100 times, x will definitely reach 0 randomly. This is elementary school multiplication problem, classmateI suggest you take another look at the Theorem of Large Numbers. The hundred times you have here are just one experiment, and you need an outer loop. . .