Recall & Review
beginner
What does
numpy.random.random() do?It generates a random float number between 0.0 (inclusive) and 1.0 (exclusive), following a uniform distribution.
Click to reveal answer
beginner
How to generate 5 random numbers between 0 and 1 using numpy?
Use
numpy.random.random(5) to get an array of 5 random floats between 0 and 1.Click to reveal answer
intermediate
How can you get random numbers between 10 and 20 using
numpy.random.random()?Multiply the output by 10 and add 10:
10 + 10 * numpy.random.random().Click to reveal answer
intermediate
What is the difference between
numpy.random.random() and numpy.random.uniform()?random() generates numbers between 0 and 1 only, while uniform(low, high) lets you specify any range.Click to reveal answer
beginner
Why is uniform random useful in data science?
It helps create random samples, simulate data, and test models with evenly spread values.
Click to reveal answer
What range of values does
numpy.random.random() generate?✗ Incorrect
numpy.random.random() generates floats from 0.0 up to but not including 1.0.How do you generate an array of 3 random numbers between 0 and 1?
✗ Incorrect
Passing 3 as an argument returns an array of 3 random floats between 0 and 1.
How to get a random number between 5 and 15 using
numpy.random.random()?✗ Incorrect
Multiply by the range (10) and add the minimum (5) to scale the output.
Which function allows specifying any range for uniform random numbers?
✗ Incorrect
numpy.random.uniform(low, high) lets you set the range explicitly.Why use uniform random numbers in simulations?
✗ Incorrect
Uniform random numbers spread evenly across the range, useful for fair sampling.
Explain how to generate random numbers between any two values using
numpy.random.random().Think about multiplying and shifting the 0 to 1 output.
You got /3 concepts.
Describe the difference between
numpy.random.random() and numpy.random.uniform().One is fixed range, the other is flexible.
You got /3 concepts.