From 11947b4584bce76167ea2dc7e6f63039d4811205 Mon Sep 17 00:00:00 2001 From: "Jared A. Scheel" Date: Sun, 3 Sep 2017 15:56:34 -0500 Subject: [PATCH] Add note to Array#sort_custom about the dangers of using random return values --- doc/base/classes.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index e04ccc724d2..a067bf2c6f3 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -5670,7 +5670,7 @@ - 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.