"R. Joseph Newton" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I'm wondering if there is an issue with the random function in terms of scaling. I have been testing a merge sort, and I noticed that when my test, built by pushing rand(100000) a given number of times into it, starts getting much higher than 10,000 items, the rnadom numbers start clumping. > > Just in case it was my sort that was the problem, I substituted the built-in sort, which does perform considerably faster, but renders the same effect. to test the algorithm, I print out the first 30 elements: > <snip program output />
> sort took 1 seconds for 60000 items > 100.7080078125 > 100.7080078125 > 100.7080078125 > 100.7080078125 > 1000.9765625 > 1000.9765625 > 1000.9765625 > 10000.6103515625 > 10000.6103515625 <snip /> > Needless to say, that is a lot of collisions. Is there any alternative random function that provides greater variation? This is not a perl issue. Perl is written in C, and the best you can get with builtin functions in C are pseudo random numbers. CPAN had a module called Math::TrulyRandom to get truly random numbers. Todd W. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]