Regarding gerenarting unique random numbers
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   lakshminarayana_jasti
Posted On:   Thursday, December 8, 2005 10:18 AM

Hi All,

I am generating unique random numbers of 5 digits, i need to generate 4000 unique numbers


Here is my code

//calling this method in loop

public int pickNumberInRange(10001, 99999) {


Random generator = new Random();

long range = (long)aUpperLimit - (long)aLowerLimit + 1;

long fraction = (long)(range * generator.nextDouble());

return (int)(fraction + aLowerLimit);

}

Thanks in Advance
jp

Re: Regarding gerenarting unique random numbers

Posted By:   WarnerJan_Veldhuis  
Posted On:   Thursday, December 8, 2005 10:56 AM

Do we have to guess what your question or the problem is!?!?
About | Sitemap | Contact