Hi --

On Sun, 7 Mar 2004, Joel VanderWerf wrote:

> Hal Fulton wrote:
> > Someone suggested allowing not just rand(Fixnum) and rand(Range)
> > but in general rand(Enumerable).
> 
> Would be tricky for general Enumerables...
> 
>    class Seq
>      include Enumerable
>      def each
>        i = 0
>        loop do
>          yield i
>          i += 1
>        end
>      end
>    end

I'm not quite following (?) -- I think the original idea was
something like:

  module Enumerable
    def rand
      to_a[Kernel.rand(size)]
    end
  end


David

-- 
David A. Black
dblack / wobblini.net