I would like to generate a random number matrix within a specified range, say (0,1).
import numpy as np
A=np.random.random((3, 3))
print("A =",[A])
>Solution :
numpy.random.uniform can receive low, high and size parameters
Range 0-1 is the default
A = np.random.uniform(size=(3, 3))
print("A =", [A])
Output
A = [array([[0.76679099, 0.57459256, 0.07952816],
[0.02736909, 0.05905416, 0.09909474],
[0.08690106, 0.81983883, 0.18740471]])]
If you want another range specify it with parameters
A = np.random.uniform(0.2, 0.3, (3, 3))
print("A =", [A])
Output
A = [array([[0.20548205, 0.25373507, 0.28957419],
[0.20496673, 0.27004844, 0.28633947],
[0.22325187, 0.26327935, 0.24548129]])]