mardi 17 janvier 2017

How to get random string value without duplicate?

I want to fetch only single company name and if again want to fetch it should not fetch duplicate value. Here is the code:

private static String[] billercompanies = 
    { 
    "1st",      
    "TELUS Communications",
   "Rogers Cablesystems",
    "Shaw Cable",
    "TELUS Mobility Inc",
    "Nanaimo Regional District of",
    "Credit Union MasterCard",
    }; 



public static String GetBillerCompany()
  {

String randomBillerComp = "";
randomBillerComp = (billercompanies[new Random().nextInt(billercompanies.length)]);
return randomBillerComp;

}




Aucun commentaire:

Enregistrer un commentaire