I am taking an introductory probability theory course and we defined a random variable as a function $X: \Omega \to \mathbb{R}$. We defined $X$ to have uniform distribution on $[0,1]$ if $$\mathbb{P}(\{\omega \in \Omega: X(\omega)=x\})= \mathbb{P}(X=x)= \begin{cases} 1 &\text{if} \ \ 0 \leq x \leq 1 \\ 0 &\text{else}\end{cases}$$ where $\mathbb{P}((a,b))=b-a$. However, we now have $\mathbb{P}(X=0) = \mathbb{P}(X=1)=1$ and so seemingly $(X=1)=[0,1]=(X=0)$. Hence for $\omega \in [0,1]$ we have $X(\omega)=0$ and $X(\omega)=1$ so $X$ is not a function (or we could use any $x\in [0,1]$ not just 0,1 to apparently get uncountably many different values of $X(\omega)$).
What am I missing here? Is this simply because I am not defining things with measure theory?