random numbers generator

could any one can give me the java code for generating 5 digit random number.
[84 byte] By [sunsridhara] at [2007-10-2 22:00:45]
# 1
Math.random()*100000 -> all numbers from 0 to 99999.99~99
Jungi-Xa at 2007-7-14 1:16:59 > top of Java-index,Desktop,Developing for the Desktop...
# 2

The following method delivers a number between 10000 and 99999:

public int generateRandom5DigitNumber() {

// get a random number between 0.0 and 0.99~999

double random = Math.random();

// initialize the return value as the smallest 5-digit number

int returnValue = 10000;

// now we have to combine the initial return value with our random number

// first we have to convert our random to a value between 0 and 89999...

int randomPartToAdd = (int)((random * 90000));

// ...and add it then to the initial value

return returnValue + randomPartToAdd;

}

falke2203a at 2007-7-14 1:16:59 > top of Java-index,Desktop,Developing for the Desktop...