i want to generate an array with predefined number of steps, all of which are random. I can do this with the following code:
xa=np.empty(100)
xa[0]=random.random()
for i in range(1,100):
xa[i]=xa[i-1]+random.random()
but I was wondering if there is a smarter way to do it, avoiding the for loop?
Aucun commentaire:
Enregistrer un commentaire