We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometimes when weight includes 0 division by zero occures
Loading development environment (Rails 4.2.0) [1] pry(main)> pond = {a: 1, b: 4, t:0} => {:a=>1, :b=>4, :t=>0} [2] pry(main)> pu = Pickup.new(pond, uniq: true) => #<Pickup:0x00000005e6a6e0 @key_func=nil, @list={:a=>1, :b=>4, :t=>0}, @uniq=true, @weight_func=nil> [3] pry(main)> pu.pick(3) => [:b, :t, :a] [4] pry(main)> pu.pick(3) => [:b, :t, :a] [5] pry(main)> pu.pick(3) => [:b, :t, :a] [6] pry(main)> pu.pick(3) ZeroDivisionError: divided by 0 from /home/ilya/.rvm/gems/ruby-2.2.0@blc/gems/pickup-0.0.10/lib/pickup.rb:128:in `block in get_random_items'
The text was updated successfully, but these errors were encountered:
Hi! Thank you for your feedback. Weight of zero is causing this edge case. I will fix it soon
Sorry, something went wrong.
Fixed
It seems still have this problem when I try the example above.
No branches or pull requests
Sometimes when weight includes 0 division by zero occures
The text was updated successfully, but these errors were encountered: