refactored weighted selection function

- isolated/unified the selection logic as `draw` function
- refactored the weight calculation for better distribution