Solution (source code)

= Solution

Let $U$ have the <uniform distribution> on $[0,1]$, and set
$$
Z_1=U,\qquad Z_2=U.
$$
The variables have the same law. They are not <independent random variables>, since
$$
\boxed{\mathbb P(Z_1\le\tfrac12,\ Z_2\le\tfrac12)=\frac12
\ne\frac14
=\mathbb P(Z_1\le\tfrac12)\mathbb P(Z_2\le\tfrac12).}
$$