Sha256: c2785d4d2ee9de9b3eecbe6311772cc66697e0acd0d3df15412786497f004edd

Contents?: true

Size: 375 Bytes

Versions: 38

Compression:

Stored size: 375 Bytes

Contents

module Pacer
  module Core
    module Route
      # Return elements based on a bias:1 chance.
      #
      # If given an integer (n) > 0, bias is calcualated at 1 / n.
      def random(bias = 0.5)
        bias = 1 / bias.to_f if bias.is_a? Fixnum and bias > 0
        chain_route :pipe_class => Pacer::Pipes::RandomFilterPipe, :pipe_args => bias
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
pacer-1.5.2-java lib/pacer/filter/random_filter.rb
pacer-1.5.1-java lib/pacer/filter/random_filter.rb
pacer-1.4.2-java lib/pacer/filter/random_filter.rb
pacer-1.4.1-java lib/pacer/filter/random_filter.rb
pacer-1.4.0-java lib/pacer/filter/random_filter.rb
pacer-1.3.5-java lib/pacer/filter/random_filter.rb
pacer-1.3.4-java lib/pacer/filter/random_filter.rb
pacer-1.3.3-java lib/pacer/filter/random_filter.rb
pacer-1.3.2-java lib/pacer/filter/random_filter.rb
pacer-1.3.1-java lib/pacer/filter/random_filter.rb
pacer-1.2.0-java lib/pacer/filter/random_filter.rb
pacer-1.1.1-java lib/pacer/filter/random_filter.rb
pacer-1.1.0-java lib/pacer/filter/random_filter.rb
pacer-1.0.3-java lib/pacer/filter/random_filter.rb
pacer-1.0.2-java lib/pacer/filter/random_filter.rb
pacer-1.0.1-java lib/pacer/filter/random_filter.rb
pacer-1.0.0-java lib/pacer/filter/random_filter.rb
pacer-0.9.1.1-java lib/pacer/filter/random_filter.rb