Add note to Array#sort_custom about the dangers of using random return values

This commit is contained in:
Jared A. Scheel 2017-09-03 15:56:34 -05:00
parent adde89e8b1
commit 11947b4584

View file

@ -5670,7 +5670,7 @@
<argument index="1" name="func" type="String">
</argument>
<description>
Sort the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise.
Sort the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise. Note: you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior.
</description>
</method>
</methods>