Skip to content

Instantly share code, notes, and snippets.

@sharathgrao
Created February 22, 2024 05:53
Show Gist options
  • Save sharathgrao/eeb013e98b77b7d3efb123484fb1341e to your computer and use it in GitHub Desktop.
Save sharathgrao/eeb013e98b77b7d3efb123484fb1341e to your computer and use it in GitHub Desktop.
numpy seed
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