+ 4

Array Shuffling( java)?

I want to shuffle array list. for example : I have two arrays String []Ab={"a","b"}; String []Bc={"c","d"}; Now I want to shuffle and merge them like "ac" or "bd"or "bc"or"ad" How is this possible?

26th Jun 2018, 5:24 PM
Rifat Bin Salam
Rifat Bin Salam - avatar
1 ответ
+ 22
String[] Ab = {"a", "b"}; String[] Bc = {"c", "d"}; int rand1 = (int)Math.round(Math.random()); int rand2 = (int)Math.round(Math.random()); System.out.println(Ab[rand1] + Bc[rand2]);
26th Jun 2018, 5:49 PM
Igor Makarsky
Igor Makarsky - avatar