Suppose that I want to create a list consisting of thousands of elements (float numbers). I want to set a minimum threshold among all of the items. So in each step, I want to append an element (float number) to the list and I want to check if the added number has the minimum difference with all of the elements.
something like this: I have a list of numbers (1.2, 2.7, 0.7, 4.9) and I want to add a new element. it should check if the randomly generated number has a minimum threshold with all of the elements and if it does not have generate another number and check the threshold again.
I would appreciate if you can give me a hint.
Aucun commentaire:
Enregistrer un commentaire