Random Number, Float, Random Boolean
by rajesh[ Edit ] 2009-12-30 16:23:19
To create a Random Number
Random rand = new Random();
int randomNumber = rand.nextInt();
To create a random number less than a value
int n = 10;
int randomNumber = rand.nextInt(n+1);
To create random Float or Long or Boolean
boolean b = rand.nextBoolean();
long l = rand.nextLong();
float f = rand.nextFloat();   Â
double d = rand.nextDouble();Â