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-2.0.24-java lib/pacer/filter/random_filter.rb
pacer-2.0.22-java lib/pacer/filter/random_filter.rb
pacer-2.0.20-java lib/pacer/filter/random_filter.rb
pacer-2.0.19-java lib/pacer/filter/random_filter.rb
pacer-2.0.18-java lib/pacer/filter/random_filter.rb
pacer-2.0.17-java lib/pacer/filter/random_filter.rb
pacer-2.0.16-java lib/pacer/filter/random_filter.rb
pacer-2.0.15-java lib/pacer/filter/random_filter.rb
pacer-2.0.14-java lib/pacer/filter/random_filter.rb
pacer-2.0.13-java lib/pacer/filter/random_filter.rb
pacer-2.0.12-java lib/pacer/filter/random_filter.rb
pacer-2.0.10-java lib/pacer/filter/random_filter.rb
pacer-2.0.10.pre-java lib/pacer/filter/random_filter.rb
pacer-2.0.8-java lib/pacer/filter/random_filter.rb
pacer-2.0.6-java lib/pacer/filter/random_filter.rb
pacer-2.0.4.pre-java lib/pacer/filter/random_filter.rb
pacer-2.0.0.pre-java lib/pacer/filter/random_filter.rb
pacer-1.6.0-java lib/pacer/filter/random_filter.rb
pacer-1.5.4-java lib/pacer/filter/random_filter.rb
pacer-1.5.3-java lib/pacer/filter/random_filter.rb