Skip to main content

Randomness Vs Cause and Effect

One of the lessons I have learned while bug fixing is that there is no such thing as Random events in a computer program. A computer program is, when you think about it - very boring. I mean it has several hundreds or thousands (depending on the program size) of rules laid out, and it behaves in a preordained manner - well at least in theory!
This is the golden rule to remember when you're debugging a seemingly unpredictable program which seemingly crashes in random situations. It is not that its behaving randomly: rather its just that you're not seeing the pattern. Sometimes its like those weird pictures that have crazy lines and shapes that make no sense what so ever, but if you stare at it for a while you see a pattern emerging and voila! there's a picture of a sad woman gazing at you ( hmm i wonder why its always a sad woman).
I mean a computer cant even generate a random number for gods sake. How can it behave randomly?! I can recall several hilarious moments when the code seemed to give particularly bizzare behavior. If you didnt know better you'd say the damned thing was playing tricks on you.
Like for example when all the Save buttons disappeared in everyones app. And this when no one had checked in any new code! Another time i was debugging a server and a loop appeared to have gone off its rocker. The loop invariant was fine and yet the debugger wouldn't go inside the loop! And then it would repeat several lines outside the loop! Hah silly me. I had deployed a different server whose source was different than the source i was debugging.
So i guess the lesson is that every bug has a cause...and Randomness is a human trait...no wait. Randomness occurs in nature doesn't it? And what about reality? If it comes to that what are true random events anyway? Like when you really like this guy and you suddenly bump into him on the elevator? (Well maybe that wasnt quite so random after all...who knows? )
To the best of my knowledge, Randomness can be mathematically measured but not proven. And what about Organized Chaos? I am constantly striving to explain to my mother this particular concept. My room may be a mess Amma, but I know where everything is. So its an organized mess!

Comments

  1. Nice post! I remember when I was in Computer Science back in the day and some people would just sit there, arms crossed, very angry saying: "I have no idea why it's doing that!!" as if the computer had a mind of it's own!! ha ha I would inevitably respond by saying: "Because, somewhere in there, that's what YOU told it to do!!!"

    As to "true random events" in reality, I think it all depends on your perception. Many people like to believe that everything is random and/or coincidental. Whereas some of us like to believe that although things might appear to be random at first glance, upon further inspection, maybe they're not so random after all... :)

    ReplyDelete
  2. Thats a really good post Niroshinie. Very Cool.

    I personally dont think there's anything random in the world, but I dont believe in destiny either. I just think that the things we do are the cause and everything that happens is the result. Just like what 1truecoolguy said the about the computer code - Because, somewhere in there, that's what YOU told it to do!!!" [Thats such a cool line :)] Our actions tell "life" what to do, if we got thru our "life-code" so to speak we'd find the cause for every bug thats been screwing up our systems :)

    ReplyDelete
  3. Thanks ppl!
    I suppose we tend to label things Random when we are at a loss to explain the cause. And its almost scary to think that nothing is random...Coz then we'd have be held accountable for all our actions and the circumstances that befall us..

    ReplyDelete
  4. Bill Gates is responsible for more than a few misbehaving computers I think.. Specially those pesky one's that make me Re-install em (coz I'm too lazy to dig deeper and find out what's wrong). he he.

    As for randomness, I'd say nothing is random. It's the law of Cause and Effect. Even Destiny is what we make of it. Not what is handed down to us on a silver platter. "Butterfly Effect" is an interesting movie for cause and effect.

    Nice post!

    ReplyDelete
  5. char-max:
    (hmm your name looks like a variable in a computer program LOL). ditto on bill gates! and i will try to get my hands on Butterfly Effect. Havent watched it yet...Tx for the tip.

    ReplyDelete
  6. thank you for your comment on my blog. I comment on what I see and percieve from this angle, and amazes me how different life is from my original expectations

    ReplyDelete

Post a Comment

Popular posts from this blog

Pervert පොසම් සහ හොර පොසම්

ඔස්ට්‍රේලියාවට වසන්ත ඍතුව එළෙඹෙන කාලය යි මේ. අපේ ගෙවත්තේ පිටුපස පීච් ගහම රෝස පාට මල්වලින් පිරිලා. හරියට මේ වගේ .... (img  commons.wikimedia.org ) තව පහු වෙනකොට ඔය පීච් ගහේ ගෙඩි එනවා ය. ඊට පස්සේ එව්වා අපිට රස බලන්න නම් හොර පොසම්ලා ට එරෙහිව යුද්ධ ප්‍රකාශ කරන්න වෙනවා ය! පොසම් කියන්නේ ඕස්ට්‍රේලියාවේ ඉන්න නිසාචර සතෙකි. හරියට ලංකාවේ වඳුරෝ වගේ උන්ගෙන් පලතුරු බේරගන්න බැරි ය. පොසම් එක්ක ඇයි හොඳයි කම් පටන් ගත්තේ ඉස්සර විශ්ව විද්‍යාල  යන කාලේ ඉඳන් ය. ඒ කාලේ මං හිටියේ තව කෙල්ලෝ දෙන්නෙක් එක්ක කාමර තුනේ ෆ්ලැට් එහෙක ය. ඒ ෆ්ලැට් එකේ නාන කාමරේ සිවිලිමට පොඩ්ඩක් යටින් ජනේලයක් විය. ඒ ජනේලේ fly-screen එකක් විය. එතන එළියේ පොඩි පඩියක් විය. අපි එතෙන්ට ගිය දවසේ ඉඳන් ජනේලේ ඇරලා ය. fly-screen එක තිබුණු නිසාත්, අපි හිටියේ උඩ තට්ටුවක නිසාත් අපි ඒ ජනේලේ වැසීම ගැන හිතුවේ නැත. ඔහොම ඉන්න අතරේ ඒ ඇරුණු ජනෙල් පියන සහ fly-screen එක අතර හිඩැසට තව පදිංචිකාරයෙක් ආවේය. ඌ ඇවිල්ලා පොසම් සතෙකි. සමහර විට ඌ ට අතේ ඇති ගානට කුලියට තැනක් හොයා ගන්න බැරි වෙන්න ඇති ය. එහෙම හිතලා අපි අපේ පාඩුවේ නාන කාමරේ වැඩ කටයුතු

Bluetooth support on Android Emulator

I have been playing around with Android lately, and one thing that annoyed me is the emulator does not support Bluetooth (as opposed to J2ME emulator, which does). So if you do not have an actual Android device (like me), and you want to do Bluetooth/WiFi programming, you run in to a problem. Fortunately, there is a way out - Install the Android image on a VM and use your own Bluetooth device. This is what I did: Download Androidx86 from http://www.android-x86.org/ . This is an .iso file, so you'd need something like VMWare or VirtualBox to run it. Me, I use VirtualBox. When creating the virtual machine, you need to set the type of guest OS as Linux instead of Other. After creating the virtual machine, set the network adapter to 'Bridged'. Start the VM and select 'Live CD VESA' at boot. Now you need to find out the ip of this VM. Go to terminal in VM (use Alt+F1 & Alt+F7 to toggle) and use the netcfg command to find this. Now you need open a command

පර්යේෂණ සහ ආචාර ධර්ම අවසරය

පසුගිය සති කීපයකම නිරත වෙලා හිටිය වැඩක ප්‍රතිපල ඊයේ ලැබුණා. ඒ මගේ පර්යේෂණය සඳහා ඕනෑ උන 'ආචාර ධර්ම අවසරය' නැත්නම් ethics clearence එක ලැබීමයි. මගේ පර්යේෂණය මුලික වශයෙන් පරිගණක විද්‍යාව සහ මෘදුකාංග ඉංජිනේරු විෂයන් වලින් කෙරුනත්, මිනිසුන් ද සහභාගී කරවාගෙන කෙරෙන කොටසක් ඇති නිසා තමා මෙහෙම අවසරයක් ගන්ඩ උනේ. ටිකක් පැහැදිලි කරොත්, මේ පර්යේෂණයේ ප්‍රථිපලයක් වන මෘදුකාංග පද්ධතිය නිවැරදිව වැඩ කරනවාද නැද්ද කියන එක තහවුරු කරන්න එක විද්‍යාගාරයක කරලා බලල මදි (සහ කරන්න අමාරුයි). 'හැබෑ ලෝකයේ' එය වැඩ කරන හැටි බලන්ඩ ඕනේ. මගේ පර්යේෂණය 'ස්මාර්ට් තාක්ෂනය' නැත්නම්, කෘතිම බුද්ධිය සහිත ගෘහස්ත පද්ධතියක් (smart home) සම්බන්ධයෙන්. වෙනත් මෘදුකාංග වලට වඩා මේ වගේ පද්ධතියක් හදන කොට ගොඩක්ම සැලකිලිමත් වෙන්න ඕනේ මිනිස්සු මෙහෙම තාක්ෂනෙකට කොහොම ප්‍රතිචාර දක්වයිද කියලා.  හිතන්න, ඔයාලගේ ගෙදරත් කෘතිම බුද්ධියක් නැත්නම් 'ස්මාර්ට්' පද්ධතියක් හයි කරලා කියලා. මේ වගේ පද්ධති වල අරමුණ මිනිසුන්ගේ ජීවිතය පහසු කරන එක. උදාහරණයකට ඔන්න ඔයාගේ 'බුද්ධිමත් ගෙදර' ලව්වා ඔයාට පුළුවන් වෙලාවට ලයිට් දාන