Uniform Distribution
Uniform Distribution
Used to describe probability where every event has equal chances of occuring.
E.g. Generation of random numbers.
It has three parameters:
low
- lower bound - default 0 .0.
high
- upper bound - default 1.0.
size
- The shape of the returned array.
ExampleGet your own Python Server
Create a 2x3 uniform distribution sample:
from numpy import random
x = random.uniform(size=(2, 3))
print(x)
Try it Yourself »
Visualization of Uniform Distribution
Example
from numpy import random
import matplotlib.pyplot as plt
import seaborn as sns
sns.distplot(random.uniform(size=1000), hist=False)
plt.show()
Result
Try it Yourself »Exercise?What is this?
Test your skills by answering a few questions about the topics of this page
The random.uniform()
method has three parameters, which ones?