8. Given the function $f(x)=\mathrm{e}^{x}\left(x-a \mathrm{e}^{x}\right)$ has exactly two critical points $x_{1} 、 x_{2}\left(x_{1}<x_{2}\right)$. Then the range of values for $a$ is $\qquad$.
8. $\left(0, \frac{1}{2}\right)$.

According to the problem, we have
$$
f^{\prime}(x)=\left(x+1-2 a \mathrm{e}^{x}\right) \mathrm{e}^{x}=0
$$

has two distinct real roots.
Let $g(x)=x+1-2 a \mathrm{e}^{x}$. Then $g(x)=0$ has two distinct real roots.
Note that, $g^{\prime}(x)=1-2 a \mathrm{e}^{x}$.
If $a \leqslant 0$, then $g^{\prime}(x) \geqslant 1$, $g(x)$ is an increasing function, and $g(x)=0$ has at most one real root, which does not meet the requirement.
If $a>0$, then when $x<\ln \frac{1}{2 a}$, $g^{\prime}(x)>0$;
when $x>\ln \frac{1}{2 a}$, $g^{\prime}(x)<0$.
Thus, $g(x)$ has a maximum at $x=\ln \frac{1}{2 a}$.
For $g(x)=0$ to have exactly two distinct real roots, we need $g\left(\ln \frac{1}{2 a}\right)>0$, i.e., $\ln \frac{1}{2 a} + 1 - 2 a \cdot \frac{1}{2 a} > 0$, which simplifies to $\ln \frac{1}{2 a} > 0$, or $0<a<\frac{1}{2}$.
Therefore, the range of $a$ is $\left(0, \frac{1}{2}\right)$.