wood burning stoves*
The moose likes Java in General and the fly likes random number generation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

random number generation

deepak borole
Greenhorn

Joined: Nov 13, 2005
Posts: 25
how to generate random numbers without repetition of numbers from a rangs in java


Winners Dont Do Different Things, They Do Things Differently !!!
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
You need to use a vector or arraylist for adding the values.. and compare the next generated value with the exisiting values whih are stored in the ArrayList

This is one way to avoid the repeation of random numbers

regards
cinux


A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Deepak, please don't post the same question in two or more different forums. It's inefficient when people are unaware that the same conversation is taking place somewhere else. Followups go here please. (This isn't really Advanced, but I like the answers in that thread better than this one.)
[ January 07, 2006: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: random number generation