Created
February 22, 2024 05:53
-
-
Save sharathgrao/eeb013e98b77b7d3efb123484fb1341e to your computer and use it in GitHub Desktop.
numpy seed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# Set the seed to 50 | |
np.random.seed(50) | |
# Generate two arrays of random numbers | |
array1 = np.random.rand(10) | |
array2 = np.random.rand(10) | |
print("Array 1:", array1) | |
print("Array 2:", array2) | |
# Set the seed to 50 again (same as before) | |
np.random.seed(50) | |
# Generate two more arrays of random numbers | |
array3 = np.random.rand(10) | |
array4 = np.random.rand(10) | |
print("\nArray 3:", array3) | |
print("Array 4:", array4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment