code: function create(list) {
    let dist = l.reduce(list, function(acc, el, i) {
      for(let j = 0; j < el.weight * 100; j++) {
        acc.push(i);
      }
      return acc;
    }, []);
  
    return function() {
      let i = dist[l.random(0, dist.length - 1)];
      return [i, list[i]];
    };
  }
docs: naive implementation of selection with replacement