Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Return a sloppy cut and shuffle of a list
ResourceFunction["SloppyShuffle"][deck] performs a single shuffle on the list deck. | |
ResourceFunction["SloppyShuffle"][deck, n] performs n shuffles on the list deck. | |
ResourceFunction["SloppyShuffle"][deck, n, slop] performs n shuffles on the list deck with a sloppiness slop. |
Cut a list of length 20 roughly in half and roughly shuffle the two lists back together:
| In[1]:= |
| Out[1]= |
Shuffle four times:
| In[2]:= |
| Out[2]= |
For general use, build a deck of cards:
| In[3]:= | ![]() |
| Out[4]= |
Shuffle the deck:
| In[5]:= | ![]() |
| Out[6]= |
Shuffle the deck seven times:
| In[7]:= |
| Out[7]= |
When the sloppiness of the shuffle increases, the number of possible outcomes increases until it reaches about.3:
| In[8]:= |
| Out[8]= |
Five shuffles usually suffices for a well-mixed deck, but seven shuffles is recommended:
| In[9]:= | ![]() |
| Out[10]= |
Setting zero sloppiness gives a perfect shuffle:
| In[11]:= |
| Out[11]= |
If the sloppiness is set to zero, there are two possible outcomes after 1 shuffle, based on choosing either an in shuffle or out shuffle:
| In[12]:= |
| Out[12]= |
Use the ResourceFunction "PlayingCardGraphic" to show the top five cards after two shuffles:
| In[13]:= | ![]() |
| Out[13]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License