/weighted

Weighted helps you to pick items from a collection by it's weight/probability.

Primary LanguageRubyMIT LicenseMIT

Weighted

Weighted helps you to pick items from a collection by it's weight/probability.

Inspired by Stackexchange solution and a (probably) nicer solution: Pickup

Installation

This was just a quick hack, too lazy to make a gem especially since Pickup is much more elegant.

Modify run.rb's call to Weighted.new and pass in a hash with items as the keys and occurances as the values. Then just run run.rb: ruby run.rb