function newDeck = perfectShuffle(oldDeck)
% PERFECTSHUFFLE
% function to perform perfect shuffle on a deck with an even number
% of cards

N = length(oldDeck);
newDeck = zeros(N,1);

N2 = N/2;

newDeck(1:2:N) = oldDeck(1:N2);
newDeck(2:2:N) = oldDeck(N2+1:N);