x = 0;
while(x < 1){
y = x;
x += rand(); // returns a real number between 0 and 1, uniformly at random
}
What is the expected value of y?
It's not very hard, but the result is surprising.
scott_wu's quiz
x = 0;
while(x < 1){
y = x;
x += rand(); // returns a real number between 0 and 1, uniformly at random
}
What is the expected value of y?
It's not very hard, but the result is surprising.