In NumPy, what does the function np.random.rand() do?
-
A
Generate random integers
-
B
Generate random floats in the half-open interval [0.0, 1.0)
Correct answer
-
C
Shuffle elements in an array
-
D
Create a random matrix
Correct answer
B. Generate random floats in the half-open interval [0.0, 1.0)
15 views
Explanation
np.random.rand() produces random floats between 0.0 (inclusive) and 1.0 (exclusive).
Video explanation
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ