How to random java string array , that each array will be true random? -
this question has answer here:
- random shuffling of array 18 answers
i have java string array looks :
string [] cards = {"c1","c2","c3", , , , , , ,, , "c45"};
so have there 45 elements , rendom them each time :
int[] cards2 = arrays.copyof(cards , cards .length); random(cards2);
how should random function ?
you can use
collections.shuffle(arrays.aslist(cards));
Comments
Post a Comment