Implement weighted random selection.  #20.