34
crisz
8y

How to pass tests, sooner or later
(free code camp)

Comments
  • 2
    What in the hell is happening here
  • 0
  • 0
    I DON'T KNOW
  • 3
    Reminds me of a cs exam I once took.

    Asked to write a sorting algorithm in Haskell that would work on list of numbers.

    I couldn't for the life of me figure out how to write mergesort and I really needed the points for the question.

    I did however know how to compute all the permutations of a given list. I also knew how to work with randoms.

    Thus was born RandomSort. The random part was actually an optimization because randomizing quicksort makes it expected to run faster.
  • 0
    also your "if" is rendundant

    you can do: return math.random() > 0.5
  • 0
    @morgh omg. This is how undocumented bugs happen
Add Comment