Skip to content

Instantly share code, notes, and snippets.

@nex3
Created June 26, 2021 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nex3/b71ee6f550d8e61dbd63aa8ddeb95915 to your computer and use it in GitHub Desktop.
Save nex3/b71ee6f550d8e61dbd63aa8ddeb95915 to your computer and use it in GitHub Desktop.
// The total number of cards in the cube.
const C = 540;
// The number of piles to create.
const p = 8;
void main() {
var indices = [
for (var i = 0; i < p; i++) ...List.filled((C / p).floor(), i + 1),
// Randomly assign the last C % p numbers to piles without
// assining any to duplicate piles.
...(List.generate(p, (i) => i + 1)..shuffle()).take(C % p)
]..shuffle();
print(indices.join(" "));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment