Pergunta de entrevista da empresa Uber

Write a function that returns values randomly, according to their weight.