4. Given that $a$ is an integer, the two real roots of the equation $x^{2}+(2 a-1) x+$ $a^{2}=0$ are $x_{1}$ and $x_{2}$. Then $\left|\sqrt{x_{1}}-\sqrt{x_{2}}\right|=$
4. 1.

From the problem, the discriminant $\Delta=-4 a+1 \geqslant 0$, so $a \leqslant 0$.
$$
\begin{array}{l}
\left(\sqrt{x_{1}}-\sqrt{x_{2}}\right)^{2}=\left(x_{1}+x_{2}\right)-2 \sqrt{x_{1} x_{2}} \\
=1-2 a+2 a=1 \\
\therefore\left|\sqrt{x_{1}}-\sqrt{x_{2}}\right|=1 .
\end{array}
$$