I'm not very good with python and I need to create a function, randvec(n), that will create an n-dimensional vector where each element is a random real number in [0,100). Below is what I have so far.
def randvec(n):
vector = np.ndarray((1,n),dtype=float)
for i in range(0,n):
vector[i] = np.random.uniform(0,100)
print(vector[i])
test = randvec(4)
print(test)
Output: [64.58722344 64.58722344 64.58722344 64.58722344]
Based on the outputs when I print inside the for loop, I don't think random.uniform() is the function I want to use because it gives me the same random number n times.
I also get this error message "index 1 is out of bounds for axis 0 with size 1."
Let me know if you see my mistakes! Thanks