In the initial state we've got a list of elements having different weights from zero to one.
let list = [
0.1,
0.83,
0.65,
0.9,
0.23,
0.17,
0.87,
0.34
];
In the final state we will need to pick only one element, though the probability should influence the result by its weight.
Question: How should the selection function look like, to solve that mathematical problem?