As $\mathbb R$ is a subset of itself and is a set of real numbers both those definitions are the same.
If $f(x) = \sin x$ has $[-1,1]\subset \mathbb R$ as it's range.
$g(x) = x^2$ has $[0,\infty)\subset \mathbb R$ as its range
and $h(x) =x^3$ has $\mathbb R\subset \mathbb R$ as its range.
And $j(x) = 7$ has $\{7\} \subset \mathbb R$ as its range.
All are real functions.
But as Jose Carlos Santos points out the actual range doesn't matter. So long as it is specified that the function's codomain (a set of which all the values of the function are mapped to) is the real numbers you don't actually have to specify the exact range.
In all my above examples it's enough to say they all map to the real numbers.