lundi 5 juillet 2021

Shuffle array element but stick element with same value

Let say I have an array like this.

int[] arr = {1,2,3,4,4,5,6,7,8,8,8};

How do I shuffle it but all with same value still besides each other?

Sample expected output after shuffle:

3,1,8,8,8,7,2,4,4,6,5



Aucun commentaire:

Enregistrer un commentaire