Tsallaka zuwa abun ciki
Justice Tech School

Random Distributions

Generators draw from normal, uniform and other distributions.

Example
rng = np.random.default_rng(0)
x = rng.normal(loc=50, scale=5, size=1000)
print(round(x.mean()), round(x.std()))
print(rng.uniform(0, 1, 2).round(2))

Result

50 5
[0.84 0.42]

Exercise

Normal draws.

rng.(0, 1, 5)

Quiz Test

What do loc and scale mean?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.