1. Learn
  2. /
  3. Courses
  4. /
  5. Sampling in Python

Connected

Exercise

Generating random numbers

You've used .sample() to generate pseudo-random numbers from a set of values in a DataFrame. A related task is to generate random numbers that follow a statistical distribution, like the uniform distribution or the normal distribution.

Each random number generation function has distribution-specific arguments and an argument for specifying the number of random numbers to generate.

matplotlib.pyplot is loaded as plt, and numpy is loaded as np.

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Generate 5000 numbers from a uniform distribution, setting the parameters low to -3 and high to 3.