Page 2 of 2

Posted: Tue Nov 06, 2007 11:33 am
by PB

Posted: Tue Nov 06, 2007 2:29 pm
by Derek
[OT]
blueznl wrote:
Derek wrote:
srod wrote:down to the shear speed of today's processors I reckon!

Code: Select all

Repeat
Until Random(100000000) = 10

Debug "Located 10 !"
Still took 20 seconds on my fast processor. :wink:
I shouldn't do these things, but I actually did a number of runs in the background, debugger on, and doing some forum browsing at the same time... and they average out at 11 seconds here :-)
I only ran it once and kind of guessed at 20 seconds, thinking about it, it was probably a lot shorter than that. :D

Also, my fast processor isn't my fastest one but it is fast compared to the p233mmx I had ten years ago. :lol: :lol:

[/OT]

Posted: Tue Nov 06, 2007 3:06 pm
by Trond
srod wrote:Aye, very nice.

In theory though, this method could lock up, forever in seach of that last 'free' element! :wink:
It won't, because the numbers aren't actually random.
That fact that it doesn't lock up is quite surprising; down to the shear speed of today's processors I reckon! Kind of like the following which I would expect to run for a long long time before finishing :

Code: Select all

Repeat
Until Random(100000000) = 10

Debug "Located 10 !"
But that's 1 in 100000000. I just require 1 in 100.

Posted: Tue Nov 06, 2007 3:30 pm
by DoubleDutch
If people are timing things, then you should agree on an initial seed value, so the results can be properly compared.

Posted: Tue Nov 06, 2007 9:15 pm
by blueznl
I said: I shouldn't be doing these kind of this.

I regret I did :) My apologies, it was not my intention to steal this thread. And if we wanna benchmark, I'm pretty sure this is not the best example to do so 8)