Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
User Journal

Journal eglamkowski's Journal: code maintenance 5

So, you're looking through some old code written years ago by someone long gone from the company. You stumble across a function named RandomSort(). Before even looking at what the function does, your reflexive reaction to a function name like that is?

This discussion has been archived. No new comments can be posted.

code maintenance

Comments Filter:
  • It obviously should be called pseudoRandomSort, since you really cannot expect to get true random number on a computer.
    • by JesseL ( 107722 )
      You can get approach pretty random numbers by seeding from analog sources like the microphone input, video camera, or the CPU temp sensor. The question of how random those numbers are degenerates rapidly into quantum physics and philosophy.
  • A few years ago, I had a job writing a program to reorder code randomly, so as to yield the same functionality. The company I was working for was making a hardware-based (pipelined) renderer, and we needed to test that the out-of-order execution wasn't breaking!

    Not quite random sort, but semi-random rearrangement :o)

  • It makes Marvin (the Martian, who is on my bookshelf) cry. And the Silver Surfer (ditto) look stern.

    At least four problems, and I haven't even looked at what it does yet.
    1. As already pointed out, it likely isn't random (this is minor in the scheme of things, but worth noting)
    2. It isn't a sort. A sort, by definition CANNOT be random. If something is random, it isn't sorted. Most likely, it is a pseudorandom LIST, but now I have to check.... an unordered list is NOT a sort people.... Grrrr
    3. Genius-boy appe
  • "Gad I hope they don't call this thing anywhere in the Accounts Receivable module!"

    So in the real world, does it implement a sort kind of like a radix sort [wikipedia.org]?

Remember, UNIX spelled backwards is XINU. -- Mt.

Working...