tomwolfe / weighted

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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

License:MIT License


Languages

Language:Ruby 100.0%