y=x where x ∊ {-2 -1 0 1 2 } fits the range. But so does y²=x² or y²-x²=0. This is a relation, not a function.
When x=-2, y=±2. This is not a function because x=2 also gives y=±2. This function has the same range as y=x. Graphically it resembles a cross formed by the lines y=x and y=-x. Apart from x=0, each value of x in the domain produces two values for y.