function random(maxSum) {
    let rs = Math.ceil(Math.random()*maxSum);
    return rs;
  }
var nums = [random(6), random(6), random(6), random(6), random(6), random(6)];
console.log(nums.reduce((a,b)=>a+b) / nums.length)random(6) возвращает целое: 1, 2, 3, 4, 5 или 6 – с равной вероятностью.(1 + 1 + 1 + 1 + 1 + 1) / 6 == 11/6 * 1/6 * 1/6 * 1/6 * 1/6 * 1/6  = 1 / 6^6 = 0,00002143347051