The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
November 2001

Advertisement

Advertisement

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.

Message:

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



Replies:

Sponsored Links



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