jeudi 25 juin 2015

generate non-consecutive samples

How can we efficiently generate k random and non-consecutive samples out of [1,...,N]?

Non-desired Example with (N=10, k=4): 2,3,8,10

This is not a desired example since 2 and 3 are consecutive.

Desired Example with (N=10, k=4): 2,6,8,10

This is a good example since the difference between every pair of samples is greater than 1




Aucun commentaire:

Enregistrer un commentaire