voraa,
мысли вслух ...
<pre>
<script>
function splitSet (set) {
const random = a => Math.trunc(Math.random() * a),
sort = (a, b) => a - b;
let {length} = set = set.slice(0), ar = [], n = 1, m = 1/((length - 1)/2);
for (let i = 1; i < length; i++) {
Math.random() > m || n++;
}
for (let i = 0; i < n; i++) {
let k = random(length - i);
ar.push(...set.splice(k, 1))
}
ar.sort(sort);
return ar[0] == 1 ? [ar, set] :[set, ar];
}
let v1 = 0;
let v2 = 0;
let v3 = 0;
let v4 = 0;
let v5 = 0
for (let i = 0; i < 63000; i++) {
let [s1, s2] = splitSet([1,2,3,4,5,6,7])
//document.write(`[[${s1}],[${s2}]], ${s1.length}, ${s2.length}<br>`)
if (s1.length == 1 && s1[0] ==1) v1++
if (s1.length == 2 && s1[0] ==1 && s1[1] == 2) v2++
if (s1.length == 3 && s1[0] ==1 && s1[1] == 2 && s1[2] == 3) v3++
if (s1.length == 4 && s1[0] ==1 && s1[1] == 2 && s1[2] == 3 && s1[3] == 4) v4++
if (s1.length == 5 && s1[0] ==1 && s1[1] == 2 && s1[2] == 3 && s1[3] == 4 && s1[4] == 5) v5++
}
document.write(`[1] - ${v1} [1,2] - ${v2} [1,2,3] - ${v3} [1,2,3,4] - ${v4} [1,2,3,4,5] - ${v5}`)
</script>
</pre>