The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Random Algorithm

Posted by Nam Hu on November 07, 2001 at 12:04 AM

I would like to write an algorithm that generates a random number from 1 - 108. The generator will give out a value randomly without repeating a value, until every single value has been selected and returned. Does anyone have an idea on how to do this?
I am thinking maybe start with an array, using a simple for loop to fill it with the values starting at 1 - 108. As for choosing randomly and then not repeating a choice I am not quite sure what to do.

-Nam Hu


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us