I would like to randomly produce a set of integers ranging from 1~100. After sorting the integers, the minimum interval between each integer should not be less than a 2. For example
2,4,8,10
satisfies the requirement while the following set
2,4,5,7
does not since the interval between 4 and 5 is less than 2. Is there any way to achieve this? Thanks!
Aucun commentaire:
Enregistrer un commentaire