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:

I don't think that would work

Posted by Nam Hu on November 07, 2001 at 9:52 AM

> Why not just use java.util.Random? or use Math.random() as a basis for calculating a random number within the range tou need

Those will generate a random number, but allow for repeats. I am trying to generate a list of numbers in random order. Once a number has been generated within that range and stored it cannot be generated again. With those two methods I believe it would be posssible, though very unlikely, to get e.g. (55, 55, 55, 55, 55...) generated. This program, however, cannot have even one number repeat.

Tell me if I am wrong




Replies:

Sponsored Links



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