jeudi 18 juin 2015

check the condition for random numbers if it is true or not?

I am new in python programming. I have defined a function which is generating a column matrix containing, let suppose x and y random values. in this function I have for loop, this loop is using these values. I want to put some condition before the for loop. condition could be x > 0.9 and y < 0.015 if this condition is wrong it should repeat for the next random values if this condition is true then it should go further....

def estimator(self):

 x_and_y = np.matrix([[np.random.random()],[np.random.random()]])

 #condition if x > 0.9 and y < 0.015 wrong generate again if condition true then go     further......
for iteration in range(self.num_iterations):

Thank you very much




Aucun commentaire:

Enregistrer un commentaire