At 05:53 AM 12/1/2005 -0800, [EMAIL PROTECTED] wrote:
random <> unique.

If you want unique numbers also put your routine above in
your program and discard duplicates.

True but over some interval they should be unique.  If they're going to
repeat every 10 or 20 times u hit the submit button, that's no good.  And
even if it was only 1 repeat it wouldn't be so bad.  We're talking about the
exact same 10 number sequence of 10+ digit numbers being reproduced!  And by
the way, if u noticed my code, it does discard duplicates and try again with
a new number.

This is something that ActiveState needs to address.


I don't think there is a problem. Random is not the same as unique, as has been posted several times now. There is no random series that is guaranteed to be unique (not contain duplicates) over any series of two or more values. Random number generators are supposed to be "sample and replace" generators. Therefore it is possible that two consecutive random numbers could be identical, or the first and 97th, or the 15th and 14398th, or ....

As others posted in the incorrectly renamed thread ("Re: Hash limits? (Was: Re: rand() not so random)") perl rand() generates only 2^15 unique values (32K). So duplicates will occur, and they should. Even if rand() actually generated 10^15 uniques then it would (and should) still generate duplicates.

A random number generator that does not produce any duplicates is not random, if you record the values returned you will eventually be able to predict what the next number in the series will be.

Chris said: "We're talking about the exact same 10 number sequence of 10+ digit numbers being reproduced!"
I do not get the same sequence of numbers  produced on a win32 platform.
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to