lundi 16 septembre 2019

Generate random integers with minimum intervals in Python

How can I generate 4 sorted random integers ranging from 1~10(inclusive) with minimum intervals? The minimum interval between each integer should not be less than a 2.

For example,

1 3 6 10

satisfies the requirement while

1 3 4 9

does not since the interval between 3 and 4 is less than 2.




Aucun commentaire:

Enregistrer un commentaire