Public
Edited
Feb 7, 2023
Insert cell
Insert cell
numberOfSuperBowls = 57
Insert cell
function sample() {
const ru = d3.randomUniform(0, 256);
const m = {};
let repeats = 0;
for (let i = 0; i < numberOfSuperBowls; i++) {
const r = Math.floor(ru());
if (m[r]) {
m[r] += 1;
repeats += 1;
} else {
m[r] = 1;
}
}
return repeats;
}
Insert cell
s = {
const n = 1000;
let totalRepeats = 0;
for (let i = 0; i < n; i++) {
totalRepeats += sample();
}
return totalRepeats / n;
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more