my dog learned polymorphism*
The moose likes Beginning Java and the fly likes storing random no in Array...wiDout repetition Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "storing random no in Array...wiDout repetition" Watch "storing random no in Array...wiDout repetition" New topic
Author

storing random no in Array...wiDout repetition

Muhammad Shahzad
Ranch Hand

Joined: Feb 17, 2002
Posts: 36
Hi,
I wana store random numbers in an Array without repetition...pleade guide me how to do it....
I am using the logic given below, but it does'nt work....

Please let me know the correct logic.
thanks
[Dave added code tags]
[ October 15, 2002: Message edited by: Dave Vick ]
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
Use a HashSet, not an array. You can later make an array from the Set if you need one.


Ron Newman - SCJP 1.2 (100%, 7 August 2002)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: storing random no in Array...wiDout repetition