mardi 30 décembre 2014

Randomizing strings without duplication

I have string with 5 different sayings and I'm trying to make them random without any duplication and repeat the saying once they all have been picked.


so far i have


final String[] mySays = { " x ", " y ", " z" , " a ", " b",}


@Override public void onClick(View v) { //change number to however number there is of "saying" int aNumber = (int) (Math.random() * 5); textOne.setText(mySays[aNumber]);


what can i add to this?


any help is greatly appreciated.





Aucun commentaire:

Enregistrer un commentaire