|
Booth wrote: >If you want uniqueness just go for a random number. >The chances of a random number duplicating are slim, This is a subject near and dear to my heart. Apologies for the bandwidth... I was once tasked with the mission of generating pseudorandom numbers to pick employees for random drug testing. The hard part of the task was that the employees had to be chosen at random. Provably so. So my random number routine (S/38 days - no C API) had to generate stream of pseudorandom numbers that was mathematically provable. So it could hold up in court-provable. I used the October 1988 issue of Communications of the ACM, article on random numbers authored by Stephen K Park and Keith W Miller as the basis of my routine (which held up in court, as it turned out.) The point is that "random" in this sense does not mean "no duplicates", but it means that one cannot predict the next number in the sequence. It is VERY likely that you will generate random numbers, depending on the universe you are choosing from. Generally, people who know about the topic (not me!) prefer the term "pseudorandom" because a given algorithm will generate the same sequence of numbers given the same starting point in the sequence. With a sequential number, one can readily predict the next number in the sequence, but one can also be 100% certain there are no duplicates until you run out of numbers in the universe (i.e. if you choose a two digit number, you'll run out quickly!) --buck
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.