powered by
This function simulates a standard riffle shuffle of a deck of 52 playing cards.
shuffle(deck)
A list of numbers. 1:52 would simulate a deck of cards in sequential order.
Returns a shuffled list (i.e. deck)
The algorithm is based on the Gilbert-Shannon-Reeds method.
Gilbert, E. (1955). Theory of shuffling. Technical memorandum, Bell Laboratories.
# NOT RUN { shuffle(1:52) # }
Run the code above in your browser using DataLab