Page 1 of 1

Non-Repeating Random Number Generator.

Posted: Wed Apr 28, 2004 5:46 pm
by Shannara
Since #PB_ANY does not generate a non-repeating random number generator, I am putting down on the wish list for a Non-Repeating Random Number Generator.

WrongGo!

Posted: Wed Apr 28, 2004 6:12 pm
by oldefoxx
You want a randomized sequence, like a deck of cards. But a proper random number generator has to allow for the real possibility that a true random state means any number can repeat. Look for routines that shuffle cards or otherwise create random sequences for your needs.

One of the responsibilities every programmer has is the need to recognize what should be within his/her ability, and what can only be resolved properly by appealing to the compiler developer. Support for new data types and structures are things best solved by changes in the compiler. Trivial efforts (and yes, once you have figured out how, randomizing a deck of cards or other sequence, is a pretty trivial effort) should not be incorporated if they add no significant benefit, or collectively end up in bloatware.

Now before you argue that a random sequence generator would benefit everyone, bear in mind that random selections are used for many purposes, even in the same game or application. If you remove a number from a possible outcome, it does not just effect that one event, it removes the same number or possibility from all other sequences that may be in progress. The compiler would have to support a whole class of sequences, each for a different purpose, each with its own seed, each with its own internal array of previously picked numbers, and each having to be associated with a different object or task. So I doubt that the so-called "benefit" here is going to justify the effort and complexity that this would require.

Posted: Wed Apr 28, 2004 9:19 pm
by GedB
There's a VB Guid generator here:

http://www.buygold.net/v01n01/v01n01.html

Shouldn't take long to convert.