i want to set buttons text by str array in random :
String str[] = { "1", "2", "3", "4", "5", "6" };
Button buttons[] = new Button[4];
buttons[0] = (Button) findViewById(R.id.id1);
buttons[1] = (Button) findViewById(R.id.id2);
buttons[2] = (Button) findViewById(R.id.id3);
buttons[3] = (Button) findViewById(R.id.id4);
for (int i = 0; i < 4; i++) {
Random r = new Random();
int x = r.nextInt(str.length);
buttons[i].setText(str[x]);
}
so how can i set buttons text without duplicates?
something like this: