[#105450] [Ruby master Feature#18228] Add a `timeout` option to `IO.copy_stream` — "byroot (Jean Boussier)" <noreply@...>
Issue #18228 has been reported by byroot (Jean Boussier).
11 messages
2021/09/27
[ruby-core:105367] [Ruby master Feature#12775] Random subset of array
From:
"nobu (Nobuyoshi Nakada)" <noreply@...>
Date:
2021-09-22 05:50:25 UTC
List:
ruby-core #105367
Issue #12775 has been updated by nobu (Nobuyoshi Nakada). Status changed from Feedback to Rejected No feedback 5 years. Feel free to re-open if you have any new points of view. ---------------------------------------- Feature #12775: Random subset of array https://bugs.ruby-lang.org/issues/12775#change-93784 * Author: sawa (Tsuyoshi Sawada) * Status: Rejected * Priority: Normal ---------------------------------------- I often see use cases to randomly sample a subset from an array like this: ```ruby a = [3, 2, 6, 2, 6, 1] a.sample(rand(a.length + 1)) # => [2, 6, 6, 3] ``` I request extending `Array#sample` to let it take an option (such as `:arbitrary`) for doing that: ```ruby a.sample(:arbitrary) # => [2, 6, 6, 3] ``` or perhaps having an independent method (like `samples`) to do it. ```ruby a.samples # => [2, 6, 6, 3] ``` -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>