0
$\begingroup$

Assume I have a program that executes the following pseudocode

x = 1
for 0 to n
    y = random real in [0,1)
    if y < x
        x = y
return x

What is the expected value of the return of this function wrt to n?

In english, set X to 1000. Choose a random real in the half-open interval [0,1) n times, setting the minimum to X. What is the expected value of X in terms of n?

$\endgroup$
1
  • $\begingroup$ The duplicate addresses a slightly more complicated question, but all the answers tackle it by first answering this question. $\endgroup$
    – whuber
    May 31, 2017 at 1:44

1 Answer 1

1
$\begingroup$

$\mathbb{E}[X]=\frac1{n+1}$

source

(your pseudo-code is ambiguous. this assumes that the for-loop executes $n$ times in total, i.e. that the maximum value is non-inclusive.)

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.