Solution (source code)

= Solution

The <empirical distribution> gives each observed value mass $1/n$, so its <empirical distribution function> is
$$
\widehat F_n(x)=\frac1n\sum_{i=1}^n\mathbf1_{\{x_i\le x\}}.
$$
For each of $B$ independent replications, draw $n$ values with replacement from this <empirical distribution>, recompute the same <estimator> $\widehat\theta^{*(b)}$, and use their sample <standard deviation>:
$$
\boxed{\widehat{\operatorname{se}}_{\rm boot}=\left[\frac1{B-1}\sum_{b=1}^B(\widehat\theta^{*(b)}-\overline\theta^*)^2\right]^{1/2}.}
$$
This estimates the conditional <bootstrap standard error>; dividing it by $\sqrt B$ would instead estimate simulation uncertainty in the bootstrap mean and is not the requested sampling <standard error>.

When the original observations are distinct, the first resampled index may be arbitrary. After $j$ distinct indices have been drawn, the next index avoids them with <probability> $1-j/n$. Multiplying conditional <probabilities> gives
$$
P_*(\text{all distinct})=\prod_{j=0}^{n-1}\left(1-\frac jn\right)=\frac{n!}{n^n},\qquad
\boxed{P_*(\text{at least one repeat})=1-\prod_{j=0}^{n-1}\left(1-\frac jn\right).}
$$
Here $P_*$ denotes <probability> conditional on the data.