// a class constructor won't do the job if no instance of // RandomNos is called r = new Random();//not the same every time // Returns 0 or 1 float holdR = r.nextFloat(); if(holdR >0.5) { return 0; } else { return 1; }
//returns 0..1.0 return r.nextFloat();
// returns a number in the range 0..range-1 return Math.abs(r.nextInt()) % range;