This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
well iam unable to create random numbers betn 1-100,without repetetion. iam declaring an array to store all random numbers. then generate an array number and compare it with array elements but it is not getting done
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
Is there a particular reason you're not using java.util.Random.nextInt ? It's not easy to program a good RNG on your own.
By without repetition you mean you want to randomly permute a sequence of numbers and then show them one by one? If that's the case I would recommend creating a list of numbers from 1 to n and then calling Collections.shuffle on it. Then your "ith" random number will be the "ith" element of this sequence.