You need to sign in to do that
Don't have an account?

how to ganerate random 6 digit number
hello friends,
I m using following code to ganarate 6 digit random number.but it creates 4-6 digit random number(eg. like 4567,98765,341235,...).But i need 6 digit random numbers only.how to solve this.
Integer index=0;
public Integer getindex()
{
double y = Math.random() ;//something between 0 and 999999
y = 999999 * y;
index = math.round(y);
return index;
}
I m using following code to ganarate 6 digit random number.but it creates 4-6 digit random number(eg. like 4567,98765,341235,...).But i need 6 digit random numbers only.how to solve this.
Integer index=0;
public Integer getindex()
{
double y = Math.random() ;//something between 0 and 999999
y = 999999 * y;
index = math.round(y);
return index;
}
As a common practice, if your question is answered, please choose 1 best answer.
But you can give every answer a thumb up if that answer is helpful to you.
Thanks
All Answers
As a common practice, if your question is answered, please choose 1 best answer.
But you can give every answer a thumb up if that answer is helpful to you.
Thanks
It worked.