mercredi 7 octobre 2015

Shuffle ArrayList without random number

Hi I want to shuffle my ArrayList without Random Number generator but only one random number can be used . is there any way to do this ?

the algorith should be based on these following:

  • size of ArrayList (non zero)
  • index of each items in ArrayList
  • Random number (cant generate inside loop, only one random number can be generated)

example

    int randomNumber = new Random(10).nextInt();
    myList = shuffle(myList, randomNumber)

    public ArrayList<> shuffle(ArrayList<> myList, int randomNumber){
      for(int index = 0 ; index < myList.size() ; index++ ){
       //shuffle algorithm working
      }
    return myList;
    }




Aucun commentaire:

Enregistrer un commentaire