Search

Introduction to Numpy Uniform Distribution

Numpy Uniform Distribution – Before moving ahead, let’s know a bit of Python Numpy Poisson Distribution

Describe the possible chances to occur every task equal times.

E.g., Probabilities of generating random numbers at equal times.

It includes three parameters:

```a - Lower Bound. Default value is 0.0.

b - Upper Bound. Default value is 1.0.

size - The shape of the returned array.```

Example – Create a 3×2 uniform distribution sample.

`from numpy import randomx = random.uniform(size=(3, 2))print(x)`
```Output -

[[0.27732781 0.06429024]
[0.08773632 0.58586866]
[0.38442203 0.65052188]]```

As shown above, it returned an array of shape 3×2 containing random decimal numbers.

Note: You will learn in detail later about Uniform Distribution Tutorial.

Visualization of Uniform Distribution

Example – Visualizing the Uniform Distribution graph without histogram.

`from numpy import randomimport matplotlib.pyplot as pltimport seaborn as klkl.distplot(random.uniform(size=1000), hist=False)plt.show()`

As a result, it Visualized the Uniform Distribution graph.

Example – Visualizing the Uniform Distribution graph with histogram.

`from numpy import randomimport matplotlib.pyplot as pltimport seaborn as klkl.distplot(random.uniform(size=1000))plt.show()`

As shown above, it Visualized the Uniform Distribution graph.

If you find anything incorrect in the above-discussed topic and have any further questions, please comment below.

Like us on

Share on