1. Home
  2. Data Science
  3. NumPy
  4. In NumPy, what does the function np.random.rand() do?

Added 28 Jan 2024

In NumPy, what does the function np.random.rand() do?

  1. Generate random integers
  2. Generate random floats in the half-open interval [0.0, 1.0) Correct answer
  3. Shuffle elements in an array
  4. Create a random matrix

Correct answer

B. Generate random floats in the half-open interval [0.0, 1.0)

15 views

MCQSEXAM

Explanation

np.random.rand() produces random floats between 0.0 (inclusive) and 1.0 (exclusive).

Video explanation

Reference

https://www.w3schools.com/python/numpy/default.asp

Doubts & discussion

Not sure why the answer is B? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More NumPy MCQs

Practise all NumPy MCQs

Similar MCQs