I have tried the following code. It loads images quite randomly but some images appear to be the same. Can my code be modified to have all the images uniquely and randomly loaded?
int[] imageViews = {
R.id.ImageView2, R.id.ImageView2,
R.id.ImageView3, R.id.ImageView4,
R.id.ImageView5, R.id.ImageView6,
R.id.ImageView7, R.id.ImageView8,
R.id.ImageView9
};
int[] images = {
R.drawable.m1, R.drawable.m2,
R.drawable.m3, R.drawable.m4,
R.drawable.m5, R.drawable.m6,
R.drawable.m7, R.drawable.m8,
R.drawable.m9
};
Random random = new Random(System.currentTimeMillis());
for(int v : imageViews) {
ImageView iv = (ImageView)findViewById(v);
iv.setImageResource(images[random.nextInt(images.length - 1)]);