Brick,
для медитации
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<script>
function qwe_()
{ var x = [.6,.3,.1]
var y = Math.random();
for (var i = 0; i < x.length; i++) {
y -= x[i];
if (y <= 0) return ++i
}
}
//тестирование
var test = {};
for (var i = 0; i < 100; i++) {
var q = qwe_();
test[q] = (test[q]||0)+1;
document.write(q)
}
document.write("<br>"+Object.values(test).map((e,i) => ++i + " => " + e + "%"))
</script>
</body>
</html>