ruby/ruby — pull request #379 by kachick (2013-08-11 03:12:36+00:00)
Title: Array#{sample,shuffle} should use random_generator_result.to_int

Is this intended?

```ruby
$VERBOSE = true

foo = Object.new

def foo.to_int
0
end

rng = -> max { foo }

class << rng
alias_method :rand, :call
end
```

ruby 2.0.0dev (2013-02-22 trunk 39375) [x86_64-linux]

```ruby
[:a, :b].sample random: rng #=> :a
[:a, :b].shuffle random: rng #=> [:b, :a]
```

ruby 2.1.0dev (2013-08-11 trunk 42503) [x86_64-linux]

```ruby
[:a, :b].sample random: rng #=> undefined method `<' for # (NoMethodError)
[:a, :b].shuffle random: rng #=> undefined method `<' for # (NoMethodError)
```