I am looking for a way to generate a sequence of m length of numbers of range from i to j with no more than k consecutive repeats for any of the numbers.
function[i=1, j=3, m=20, k=2]
output = {1, 2, 2, 3, 1, 3, 2, 3, 1, 3, 2, 1, 2, 1, 3, 2, 2, 1, 3}
Something like this but can someone please implement this in Java?
Thanks :)
Aucun commentaire:
Enregistrer un commentaire