Skip to content

Instantly share code, notes, and snippets.

@nex3
Created Jun 26, 2021
Embed
What would you like to do?
// 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