[algogeeks] Java Random Method

2010-06-26 Thread trdant
I have the following sequence of integers: 104,105,106,108 and need to write a Java statement to randomly produce one of these numbers. I basically need a non-linear random number generator. Any ideas? Travis -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Java Random Method

2010-06-26 Thread Anurag Sharma
int getNum(){ int arr[]={104,105,106,108}; return arr[(int)(Math.random()*4)]; } Anurag Sharma On Sat, Jun 26, 2010 at 8:43 PM, trdant trd...@gmail.com wrote: I have the following sequence of integers: 104,105,106,108 and need to write a Java statement to randomly produce one of these

Re: [algogeeks] Java Random Method

2010-06-26 Thread Chakravarthi Muppalla
@trdant, is non-linear random number different from general random number? On Sun, Jun 27, 2010 at 9:36 AM, Anurag Sharma anuragvic...@gmail.comwrote: int getNum(){ int arr[]={104,105,106,108}; return arr[(int)(Math.random()*4)]; } Anurag Sharma On Sat, Jun 26, 2010 at 8:43 PM,