Basic sort, with annoying bug Your input is a list/sequence/vector/array of 5-255 positive integers, not necessarily unique.  You may assume whatever input format is most suitable, and that each integer (as well as the quantity of integers) is chosen uniformly at random from the range 5-255.

The goal is to output the same list, in the same (or equivalent) format, but sorted into increasing (nondecreasing) order. A common early exercise in learning a language.  Submissions to include:


An answer which works correctly and achieves the goal; and
A second answer which contains an annoying bug.  Between 1% and 10% of the time, the output needs to be a list in the correct format and containing the correct elements, but in the wrong order (any order except correctly sorted).  The rest of the time, the program must work correctly and achieve the goal.


The two answers must have Levenshtein distance one; that is, we can get one from the other by deleting one byte, or adding one byte, or changing one byte.

Scoring as usual in code-golf (based on the shorter of your two answers), with usual loopholes forbidden.

10% bonus (decrease to score) if the annoying bug is input-independent, i.e. using the same input again doesn't reproduce the bug (except between 1% and 10% of the time).
Python 3, 36 bytes

Bug-free version, 37 bytes



lambda l:sorted(l,reverse=l[-9:]==[])


Try it online!

Annoying version, 36 bytes



lambda l:sorted(l,reverse=l[9:]==[])


Try it online!

This depends on the input and therefore does not qualify for the bonus.
It has a probability of around 2% to fail. It fails when the input length is lower then 10.

Combined with LyricLy's answer this gets 34 bytes:

lambda l:sorted(l)[::l[9:]&gt;[]or 1]
lambda l:sorted(l)[::l[9:]&gt;[]or-1]