主題
Search

洗牌


洗牌,也稱為法羅洗牌,是一種洗牌方式,其中一副 2n 張牌的牌堆被分成兩個一半。牌堆的上半部分放在左手中,然後牌從左手和右手(內洗)或從右手和左手(外洗)交替地交錯。使用內洗,最初排列為 1 2 3 4 5 6 7 8 的牌堆將變為 5 1 6 2 7 3 8 4。使用外洗,牌堆順序將變為 1 5 2 6 3 7 4 8。洗牌用於紙牌魔術(Marlo 1958ab, Adler 1973),也用於並行處理理論(Stone 1971, Chen et al. 1981)。

洗牌操作在 Wolfram 語言中實現為

  Riffle @@ Partition[Range[n], n/2, n/2, 1, {}]

一般來說,牌 k 移動到最初由第 2k 張牌佔據的位置,模 2n+/-1。對於內洗,第一張牌編號為 1,乘法運算以 2n+1 為模進行。對於外洗,第一張牌編號為 0,乘法運算以 2n-1 為模進行。請注意(在外洗情況下),這會將第一張牌和最後一張牌對映為 0,但這很有意義,因為它們都是不動點。

因此,當 n+1 為素數時,內洗偶數 n 張牌 n 次會使牌恢復到原始順序。類似地,當 n-1 為素數時,外洗偶數 n 張牌 n-2 次會使牌恢復到原始順序 (Diaconis et al. 1983, Conway and Guy 1996)。一副普通的 52 張牌的牌堆在 52 次內洗後會恢復到原始順序,但僅在八次外洗後就會恢復!

Aldous (1983) 表明,3/2log_2n (糾正了一個錯字) 次洗牌足以使大型 n-張牌的牌堆隨機化,對於一副 52 張的牌堆,需要八到九次洗牌。當與 Aldous 和 Diaconis (1986) 的結果結合時,該分析表明,需要七次洗牌才能接近隨機 (Aldous and Diaconis 1986, Bayer and Diaconis 1992)。這介於洗牌次數太少和洗牌次數過多導致效果降低之間。

Morris (1994) 討論了完美洗牌的各個方面(其中牌堆被精確地切成兩半,並且牌被完美地交錯)。Ramnath 和 Scully (1996) 給出了將牌從任意位置 i 移動到位置 j 的最短的內洗和外洗序列的演算法。此演算法適用於任何牌數為偶數的牌堆,並且複雜度為 O(log_2n)


另請參閱

紙牌, 洗牌

使用 探索

WolframAlpha

更多嘗試

參考文獻

Adler, I. "Make Up Your Own Card Tricks." J. Recr. Math. 6, 87-91, 1973.Aldous, D. Random Walks on Finite Groups and Rapidly Mixing Markov Chains. Berlin: Springer-Verlag, pp. 243-297, 1983.Aldous, D. and Diaconis, P. "Shuffling Cards and Stopping Times." Amer. Math. Monthly 93, 333-348, 1986.Ball, W. W. R. and Coxeter, H. S. M. Mathematical Recreations and Essays, 13th ed. New York: Dover, pp. 323-325, 1987.Bayer, D. and Diaconis, P. "Trailing the Dovetail Shuffle to Its Lair." Ann. Appl. Probability 2, 294-313, 1992.Chen, P. Y.; Lawrie, D. H.; Yew, P.-C.; and Padua, D. A. "Interconnection Networks Using Shuffles." Computer 33, 55-64, Dec. 1981.Conway, J. H. and Guy, R. K. "Fractions Cycle into Decimals." In The Book of Numbers. New York: Springer-Verlag, pp. 163-165, 1996.Diaconis, P.; Graham, R. L.; and Kantor, W. M. "The Mathematics of Perfect Shuffles." Adv. Appl. Math. 4, 175-196, 1983.Gardner, M. Mathematical Carnival: A New Round-Up of Tantalizers and Puzzles from Scientific American. Washington, DC: Math. Assoc. Amer., 1989.Golomb, S. W. "Permutations by Cutting and Shuffling." SIAM Rev. 3, 293-297, 1961.Herstein, I. N. and Kaplansky, I. Matters Mathematical. New York: Harper & Row, 1974.Mann, B. "How Many Times Should You Shuffle a Deck of Cards." UMAP J. 15, 303-332, 1994.Marlo, E. Faro Notes. Chicago, IL: Ireland Magic Co., 1958a.Marlo, E. The Faro Shuffle. Chicago, IL: Ireland Magic Co., 1958b.Medvedoff, S. and Morrison, K. "Groups of Perfect Shuffles." Math. Mag. 60, 3-14, 1987.Morris, S. B. "Practitioner's Commentary: Card Shuffling." UMAP J. 15, 333-338, 1994.Morris, S. B. and Hartwig, R. E. "The Generalized Faro Shuffle." Discrete Math. 15, 333-346, 1976.Peterson, I. Islands of Truth: A Mathematical Mystery Cruise. New York: W. H. Freeman, pp. 240-244, 1990.Ramnath, S. and Scully, D. "Moving Card i to Position j with Perfect Shuffles." Math. Mag. 69, 361-365, 1996.Sloane, N. J. A. Sequences A059953 and A059954 in "The On-Line Encyclopedia of Integer Sequences."Stone, H. S. "Parallel Processing with the Perfect Shuffle." IEEE Trans. Comput. 2, 153-161, 1971.

在 上被引用

洗牌

請引用為

韋斯坦因,埃裡克·W. "洗牌。" 來自 Web 資源。 https://mathworld.tw/RiffleShuffle.html

學科分類