Let two functions $f,g :[n]\to \{0,1\},$ then we define $$\delta{(f,g)}=\frac{|\{i\in[n]:f(i)\neq g(i) \}|}{n}$$ is called normalized hamming distance.
My teacher said me this $\delta{(f,g)}$ is equivalent to
$$\mathcal{P}\{f(i)\neq g(i)\},$$ where $i$ chosen uniformly at random.
$$\mathop{\mathbb{E}}\{1_{f(i)\neq g(i)}\},$$ the indicator function.
Anybody give me any example by which I can see above three derives the same value.
For example, $f=1011, g=0101$, I clearly see $\delta(f,g)=\frac{3}{4},$ how can I derive probability and expectations from above also $\frac{3}{4}?$