lundi 20 mars 2017

Insert random elements of array into another array with specific index in java

so I have an array of names like this:

String[] arrayOfName = {"Elephant", "Deer", "Fish", "Crocodile", "Cat", "Dog", "Bird", "Butterfly", "Chicken", "Ant", "Snake", "Lion", "Horse", "Wolf", "Panda", "Swan", "Lobster"};

I was thinking about if have another array, and I wanna put between 4 to 10 (it's random, between 4 to 10) random names from arrayOfName into my new array.




Aucun commentaire:

Enregistrer un commentaire