mercredi 26 août 2020

String Random Generator With Probability

Let say i have a set of Browsers to run the tests on

and

i use the String Random generator like this

String randombrowser[]= {"Chrome","Firefox","Edge","Safari"};
Random pickRandomBrowser= new Random();
int i=pickRandomBrowser.nextInt(4);

but i want Safari to be least picked and Chrome to be top pick how to achieve that ?

Aucun commentaire:

Enregistrer un commentaire