Magic numbers are not readable
for (int i = 1; i =< 52; i++) {
j = i + randomInt(53 - i) – 1
swapEntries(i, j)
}
Replace with constants.
final int DECKSIZE = 52;
for (int i = 1; i =< DECKSIZE; i++) {
j = i + randomInt(DECKSIZE + 1 - i) – 1
swapEntries(i, j)
}
Comments