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:

Mine [10,000 items]

sort took 1 seconds for 10000 items
12.20703125
21.3623046875
21.3623046875
42.724609375
61.03515625
76.2939453125
91.552734375
94.6044921875
106.8115234375
106.8115234375
112.9150390625
115.966796875
125.1220703125
128.173828125
143.4326171875
155.6396484375
167.8466796875
170.8984375
192.2607421875
195.3125
213.623046875
213.623046875
228.8818359375
250.244140625
286.865234375
286.865234375
289.9169921875
357.0556640625
369.2626953125
390.625

Mine [60,000 items]

sort took 7 seconds for 60000 items
3.0517578125
9.1552734375
12.20703125
12.20703125
15.2587890625
15.2587890625
18.310546875
18.310546875
18.310546875
18.310546875
21.3623046875
24.4140625
27.4658203125
27.4658203125
27.4658203125
30.517578125
30.517578125
30.517578125
30.517578125
33.5693359375
33.5693359375
36.62109375
36.62109375
39.6728515625
39.6728515625
42.724609375
42.724609375
42.724609375
45.7763671875
45.7763671875

Built-in [10000 items]

sort took 0 seconds for 10000 items
10015.869140625
10015.869140625
10021.97265625
10031.1279296875
1004.0283203125
10040.283203125
10040.283203125
10043.3349609375
10052.490234375
10061.6455078125
10067.7490234375
1007.080078125
10073.8525390625
10086.0595703125
10104.3701171875
10113.525390625
10116.5771484375
10122.6806640625
10153.1982421875
1016.2353515625
10171.5087890625
10189.8193359375
10217.28515625
10229.4921875
10247.802734375
10269.1650390625
10278.3203125
10290.52734375
10293.5791015625
10293.5791015625

Built-in [60000 items]

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
10000.6103515625
10003.662109375
10003.662109375
10006.7138671875
10006.7138671875
10006.7138671875
10006.7138671875
10006.7138671875
10006.7138671875
10009.765625
10009.765625
10009.765625
10012.8173828125
10012.8173828125
10015.869140625
10018.9208984375
10021.97265625
10021.97265625
10025.0244140625
10028.076171875
10028.076171875

Needless to say, that is a lot of collisions.  Is there any alternative random 
function that provides greater variation?

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to