weighted_randomizer icon indicating copy to clipboard operation
weighted_randomizer copied to clipboard

Provides a common utility for weighted randomization

Results 3 weighted_randomizer issues
Sort by recently updated
recently updated
newest added

I know it's abandoned gem. But seems like [here](https://github.com/ryanlecompte/weighted_randomizer/blob/master/lib/weighted_randomizer.rb#L38) should be `

The definition of sample is that it should be WITHOUT replacement. From the Rubydocs on Array#sample: The elements are chosen by using random and unique indices into the array in...

``` @inserciones = Adblock.where(code: @sponsorsection).inject({}) {|h, p| h[p.id] = p.ranking; h} @ofertas_select2 = WeightedRandomizer.new(@inserciones) @ofertas_select = @ofertas_select2.sample(3) @coupons = [] @ofertas_select.each do |o| @insert = Adblock.find(o) @oferta = @insert.coupon if...