I have to generate 80 random letters of the English alphabet (capital letters) and display them in a row of 10 letters per row. I have a similar code for bingo numbers but I'm not sure what to change to adapt it for the alphabet
bingo = 1 : 99;
for i = 1 : 99
temp = bingo(i);
swop = floor(rand * 99 1);
bingo(i) = bingo(swop);
bingo(swop) = temp;
end
for i = 1 : 10 : 81
disp(bingo(i : i 9))
end
disp(bingo(91 : 99))
How do I adapt it for the alphabet?
CodePudding user response:
>> letters = ‘A’:’Z’;
>> letters(randi(26, 8, 10))
ans =
8×10 char array
'VYKRHLSYXV'
'XZXTBJTIYG'
'DEUTCTHPOY'
'XZYKVURFDJ'
'QYRRSERTDF'
'CMAEIMEGGG'
'HUWSYLDNVQ'
'ODYAAQMSGM'