Non-Repeating Random Number Generator.

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Non-Repeating Random Number Generator.

Post 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.
oldefoxx
Enthusiast
Enthusiast
Posts: 532
Joined: Fri Jul 25, 2003 11:24 pm

WrongGo!

Post 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.
has-been wanna-be (You may not agree with what I say, but it will make you think).
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

There's a VB Guid generator here:

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

Shouldn't take long to convert.
Post Reply