July 2017
Beginner to intermediate
420 pages
10h 56m
English
Let's start off with a really simple example: uniform distribution. A uniform distribution just means there's a flat constant probability of a value occurring within a given range.
import numpy as np Import matplotlib.pyplot as plt values = np.random.uniform(-10.0, 10.0, 100000) plt.hist(values, 50) plt.show()
So we can create a uniform distribution by using the NumPy random.uniform function. The preceding code says, I want a uniformly distributed random set of values that ranges between -10 and 10, and I want 100000 of them. If I then create a histogram of those values, you can see it looks like the following.

There's ...
Read now
Unlock full access