Published
Edited
Jun 29, 2022
Insert cell
Insert cell
// A different seed will generate different groups
seed = "9pb7"
Insert cell
// Change the implementation to see how the groups change
function group(id) {
// const multiplier = Number(random[id % random.length]);
// return (id + multiplier) % 3;
// return id % 2;
// return Math.random() > 0.5 ? 0 : 1;
return Math.abs(cryptoJS.default.MD5(id.toString() + seed).words[0]) % n;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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