4. Let \( f(x) = \begin{cases} x^2, & |x| \geqslant 1 ; \\ k x, & |x| < 1, \end{cases} \) and \( g(x) \) be a quadratic function. If the range of \( f(g(x)) \) is \([0, +\infty)\), then the range of the real number \( k \) is \(\qquad\).
4. $k \leqslant-1$ or $k \geqslant 1$.

Notice that, the points $(1,1)$, $(-1,1)$, and $(0,0)$ are all on the graph of $f(x)$.

When $k \neq \pm 1$, the points $(1, k)$ and $(-1,-k)$ are not on the graph of $f(x)$, and the range of $g(x)$ is an interval of the form $(-\infty, m]$ or $[n,+\infty)$. By the problem statement, we know that the point $(1, k)$ is not below the point $(1,1)$ or the point $(-1, k)$ is not below the point $(-1,1)$. Therefore, $k \geqslant 1$ or $-k \geqslant 1$, i.e., $k \geqslant 1$ or $k \leqslant-1$.