I am creating a program that generates a random bingo card every time you play. I cannot figure out how to not get duplicate random numbers. I am always getting at least 2 of the same numbers. I have tried many different ways but this is what i've ended up with and it still duplicates. Please help!
for (int p = 0; p < b.length; p++) { //loop that assigns random
number
b[p] = (int) (Math.random() * 14 + 1);
do {
b[1] = (int) (Math.random() * 14 + 1);
} while (b[1] == b[0]);
do {
b[2] = (int) (Math.random() * 14 + 1);
} while (b[2] == b[1] || b[2] == b[0]);
do {
b[3] = (int) (Math.random() * 14 + 1);
} while (b[3] == b[0] || b[3] == b[1] || b[3] == b[2]);
do {
b[4] = (int) (Math.random() * 14 + 1);
} while (b[4] == b[0] || b[4] == b[1] || b[4] == b[2] || b[4] == b[3]);
}