Shuffling and Using a Set of Six 52-Card Decks
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
In my current project, the goal is to create a vector of a randomized "playing card" matrix to implment into my code. I was wondering on how I could create a vector which would be a randomied version of the original "decksofcards" vector using the same numbers without repitition. Thank you!
This is what I have so far.
cardpack = [2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 6 6 6 6 7 7 7 7 8 8 8 8 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 11 11 11 11];
decksofcards = repmat(cardpack,1,6);
randomcards = randperm(312);
for q = 1:length(deckofcards)
shuffledcard(q) = randomcards(q);
end
0 comentarios
Respuestas (1)
James Tursa
el 9 de Ag. de 2019
Editada: James Tursa
el 9 de Ag. de 2019
It is not entirely clear what you want. Maybe this instead of the loop?
shuffledcard = decksofcards(randomcards);
1 comentario
Ver también
Categorías
Más información sobre Desktop en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!