Is there an equivalent to `Array::sample` for hashes? May 15, 2023 by Tarik Hash[original_hash.to_a.sample(n)] For Ruby 2.1, original_hash.to_a.sample(n).to_h