NumPy: Generate a random number between 0 and 1
NumPy: Basic Exercise-17 with Solution
Write a NumPy program to generate a random number between 0 and 1.
Sample Solution :
Python Code :
import numpy as np rand_num = np.random.normal(0,1,1) print("Random number between 0 and 1:") print(rand_num)
Random number between 0 and 1: [-1.15262276]
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
What is the difficulty level of this exercise?
- New Content published on w3resource :
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework