Python Simulation: Values of Uniform Distribution overshoots the range

37 Views Asked by At

I am trying to plot the uniform distribution. It is supposed to be looking like the following.

enter image description here

Source:https://www.youtube.com/watch?v=UC-CBUSQXAo

However, when I try to plot it myself using the python code, it looks like the following.

enter image description here

Source: https://numpy.org/doc/stable/reference/random/generated/numpy.random.uniform.html

It is evident that the range is overshooting many times. Even when I understand that the total area remains 1, why is there an overshoot at the first place? Shouldn't it be between 0 and 1 only?

Please explain.