mercredi 15 septembre 2021

How to generate a list of random floats within an interval with a minimum separation distance?

I want to generate a list of random floats within an interval while specifying a minimum distance/step size.

#Example of generations for the same min, max, minimum_step inputs:
min = 2.7
max = 24.3
minimum_step = 3.2
random_gen(min, max, minimum_step)

output:
a1 = [3.65, 6.8, 9.9]
a2 = [7.2, 10.9, 14.7, 19.0, 23.34]
a3 = [12.1]
a4=[2.7, 5.0, 8.2, 11.76, 15.8, 19.31, 24.3]



Aucun commentaire:

Enregistrer un commentaire