Published
Edited
Jun 24, 2022
14 stars
Insert cell
Insert cell
Insert cell
Insert cell
wealth = {
const numPeople = 100;
const wealth = new Float64Array(numPeople).fill(100);
while (true) {
for (let i = 0; i < numPeople; i++) {
if (wealth[i] > 0) {
const target = Math.floor(numPeople * Math.random());
wealth[target] += 1;
wealth[i] -= 1;
}
}
yield wealth;
}
}
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