News for hackers. Stuff that matters.
Re:Is this the simplest (and most surprising) sorting algori... by jtolmar on Tuesday October 05, 2021 @07:33PM (#28767111)
You can turn a sort into a shuffle by replacing the comparator with a random coin flip, and you already have defined a sort algorithm, so there's no added code complexity.

    fn bogosort(a, comparator):
      while not is_sorted(a, comparator) do
        bogosort(a, rand)
Re:Is this the simplest (and most surprising) sorting algori... by aidenn0 on Tuesday October 05, 2021 @08:05PM (#28767400)
You can't turn all sorts (not even all comparison sorts!) into a shuffle by replacing the comparator with a random coin flip. In fact your code post is a demonstration of that fact.