A uniformly distributed random variable on the interval \([a,b]\) will have a constant positive value for point within the given interval, and zero elsewhere. This constant satisfies
\(\displaystyle\int_{-\infty}^\infty f_X(x)\,\mathrm dx=\int_a^b c\,\mathrm dx=1\)
Integrating, you get
\(\displaystyle\int_a^b c\,\mathrm dx=cx\bigg|_{x=a}^b=c(b-a)=1\implies c=\dfrac1{b-a}\)
So the density function is
\(f_X(x)=\begin{cases}\dfrac1{b-a}&\text{for }a\le x\le b\\[1ex]0&\text{otherwise}\end{cases}\)