refactored weighted selection function

- isolated the selection logic as "draw" function
- refactored the weight calculation for better distribution
Merge pull request #1 from sakatam/refactor-weighted-selection

refactored weighted selection function