arrays - Pick random from Java List [] -
i have list of 14 items use in method. wondering how can make randomly pick different items list instead of forcing selecting list number [0] etc. code in method this.
stats.list[0].clone ();
i need like..
stats.list[randomnumber/decision].clone ();
my list code
list [0] = new ped (names.getstring("idc"), "c"); list [1] = new ped (names.getstring("id"), "d");
thanks ya help!
random r = new random(); int randomnum = r.nextint(sizeoflist); stats.list[randomnum].clone ();
use random class.
Comments
Post a Comment