Created
June 26, 2021 22:22
-
-
Save nex3/b71ee6f550d8e61dbd63aa8ddeb95915 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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