Sha256: 4924cda44477317068ca52f8a17a34eb4aaae8cd1c8a0a211dcd542f99762dab
Contents?: true
Size: 451 Bytes
Versions: 15
Compression:
Stored size: 451 Bytes
Contents
module LaunchDarkly module Impl class Sampler # # @param random [Random] # def initialize(random) @random = random end # # @param ratio [Int] # # @return [Boolean] # def sample(ratio) return false unless ratio.is_a? Integer return false if ratio <= 0 return true if ratio == 1 @random.rand(1.0) < 1.0 / ratio end end end end
Version data entries
15 entries across 15 versions & 1 rubygems