Class Choose::MockRandomGenerator
In: lib/choose.rb
Parent: RandomGenerators::RandomGenerator

Methods

Attributes

ref  [R] 

Public Class methods

[Source]

# File lib/choose.rb, line 92
      def initialize ( tab_i, tab_f )
        raise unless tab_i.is_a? Array
        raise unless tab_f.is_a? Array
        @ref, @ref_f, @pos = tab_i, tab_f, -1
      end

Public Instance methods

[Source]

# File lib/choose.rb, line 104
      def choose_float ( f=1.0 )
        check_choose_float(f)
        get(@ref_f) * f
      end

[Source]

# File lib/choose.rb, line 100
      def choose_integer ( n )
        check_choose_integer(n)
        get(@ref) % n
      end

[Source]

# File lib/choose.rb, line 97
      def get ( tab )
        tab[@pos = (@pos + 1) % tab.size]
      end

[Validate]