skip to main content
research-article
Open Access

Generating Random Permutations by Coin Tossing: Classical Algorithms, New Analysis, and Modern Implementation

Published:07 February 2017Publication History
Skip Abstract Section

Abstract

Several simple, classical, little-known algorithms in the statistics and computer science literature for generating random permutations by coin tossing are examined, analyzed, and implemented. These algorithms are either asymptotically optimal or close to being so in terms of the expected number of times the random bits are generated. In addition to asymptotic approximations to the expected complexity, we also clarify the corresponding variances, as well as the asymptotic distributions. A brief comparative discussion with numerical computations in a multicore system is also given.

References

  1. R. J. Anderson. 1990. Parallel algorithms for generating random permutations on a shared memory machine. In Proceedings of the 2nd Annual ACM Symposium on Parallel Algorithms and Architectures. 95--102. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. D. M. Andrés and L. P. Pérez. 2011. Efficient parallel random rearrange. In Proceedings of the International Symposium on Distributed Computing and Artificial Intelligence. Springer, 183--190.Google ScholarGoogle Scholar
  3. E. B. Barker and J. M. Kelsey. 2007. Recommendation for Random Number Generation using Deterministic Random Bit Generators (Revised). U.S. Department of Commerce, Technology Administration, National Institute of Standards and Technology, Computer Security Division, Information Technology Laboratory.Google ScholarGoogle Scholar
  4. K. J. Berry, J. E. Johnston, and P. W. Mielke, Jr. 2014. A Chronicle of Permutation Statistical Methods (1920--2000, and Beyond). Springer, Berlin.Google ScholarGoogle Scholar
  5. G. Brassard and S. Kannan. 1988. The generation of random permutations on the fly. Inform. Process. Lett. 28, 4 (1988), 207--212. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. C.-H. Chen. 2002. Generalized association plots: Information visualization via iteratively generated correlation matrices. Stat. Sin. 12, 1 (2002), 7--30.Google ScholarGoogle Scholar
  7. L. Devroye. 1986. Nonuniform Random Variate Generation. Springer-Verlag, New York.Google ScholarGoogle Scholar
  8. L. Devroye. 2010. Complexity questions in non-uniform random variate generation. In Proceedings of COMPSTAT 2010. Springer, 3--18.Google ScholarGoogle ScholarCross RefCross Ref
  9. L. Devroye and C. Gravel. 2016. The expected bit complexity of the von Neumann rejection algorithm. Stat. Comput. (2016), 1--12.Google ScholarGoogle Scholar
  10. R. Durstenfeld. 1964. Algorithm 235: Random permutation. Commun. ACM 7, 7 (1964), 420. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. A. Erdélyi, W. Magnus, F. Oberhettinger, and F. G. Tricomi. 1953. Higher Transcendental Functions. Vol. I. McGraw--Hill, New York, NY.Google ScholarGoogle Scholar
  12. R. A. Fisher and F. Yates. 1948. Statistical Tables for Biological, Agricultural and Medical Research. 3rd ed. Oliver 8 Boyd.Google ScholarGoogle Scholar
  13. P. Flajolet, É. Fusy, and C. Pivoteau. 2007. Boltzmann sampling of unlabelled structures. In Proceedings of the 9th Workshop on Algorithm Engineering and Experiments and the Fourth Workshop on Analytic Algorithmics and Combinatorics. SIAM, Philadelphia, PA, 201--211. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. P. Flajolet, X. Gourdon, and P. Dumas. 1995. Mellin transforms and asymptotics: Harmonic sums. Theoret. Comput. Sci. 144, 1--2 (1995), 3--58. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. P. Flajolet, M. Pelletier, and M. Soria. 2011. On Buffon machines and numbers. In Proceedings of the Twenty-2nd Annual ACM-SIAM Symposium on Discrete Algorithms (SODA’11). 172--183. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. P. Flajolet and R. Sedgewick. 1995. Mellin transforms and asymptotics: Finite differences and Rice’s integrals. Theoret. Comput. Sci. 144, 1--2 (1995), 101--124.Google ScholarGoogle ScholarCross RefCross Ref
  17. P. Flajolet and R. Sedgewick. 2009. Analytic Combinatorics. Cambridge University Press, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. Fuchs, H.-K. Hwang, and V. Zacharovas. 2014. An analytic approach to the asymptotic variance of trie statistics and related structures. Theoret. Comput. Sci. 527 (2014), 1--36. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. P. J. Grabner and H.-K. Hwang. 2005. Digital sums and divide-and-conquer recurrences: Fourier expansions and absolute convergence. Constr. Approx. 21, 2 (2005), 149--179.Google ScholarGoogle ScholarCross RefCross Ref
  20. L. Granboulan and T. Pornin. 2007. Perfect block ciphers with small blocks. In Proceedings of the 14th International Workshop on Fast Software Encryption (FSE’07). 452--465. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. C. Gravel. 2015. Échantillonnage de Distributions Non Uniformes en Précision Arbitraire et Protocoles d’échantillonnage Exact Distribué Des Distributions Discrètes Quantiques. Ph.D. Dissertation. Université de Montréal.Google ScholarGoogle Scholar
  22. Y. Horibe. 1981. Entropy and an optimal random number transformation. IEEE Trans. Inform. Theory 27, 4 (1981), 527--529. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. H.-K. Hwang. 2003. Second phase changes in random m-ary search trees and generalized quicksort: Convergence rates. Ann. Probab. 31, 2 (2003), 609--629.Google ScholarGoogle ScholarCross RefCross Ref
  24. H.-K. Hwang, M. Fuchs, and V. Zacharovas. 2010. Asymptotic variance of random symmetric digital search trees. Discr. Math. Theor. Comput. Sci. 12, 2 (2010), 103--165.Google ScholarGoogle Scholar
  25. Intel. 2012. Intel Digital Random Number Generator (DRNG): Software Implementation Guide. Intel Corporation.Google ScholarGoogle Scholar
  26. P. Jacquet and W. Szpankowski. 1998. Analytical de-poissonization and its applications. Theoret. Comput. Sci. 201, 1--2 (1998), 1--62. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. G. W. Kimble. 1989. Observations on the generation of permutations from random sequences. Int. J. Comput. Math. 29, 1 (1989), 11--19.Google ScholarGoogle ScholarCross RefCross Ref
  28. D. E. Knuth. 1998a. The Art of Computer Programming. Vol. 2, Seminumerical Algorithms. Addison-Wesley, Reading, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. D. E. Knuth. 1998b. The Art of Computer Programming. Vol. 3. Sorting and Searching (2nd ed.). Addison-Wesley, Reading, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. D. E. Knuth and A. C. Yao. 1976. The complexity of nonuniform random number generation. Algorithms and Complexity: New Directions and Recent Results. Academic Press, New York, 357--428.Google ScholarGoogle Scholar
  31. B. Koo, D. Roh, and D. Kwon. 2014. Converting random bits into random numbers. J. Supercomput. 70, 1 (2014), 236--246. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. C.-A. Laisant. 1888. Sur la numération factorielle, application aux permutations. Bull. Soc. Math. France 16 (1888), 176--183.Google ScholarGoogle ScholarCross RefCross Ref
  33. D. Langr, P. Tvrdík, T. Dytrych, and J. P. Draayer. 2014. Algorithm 947: Paraperm—parallel generation of random permutations with MPI. ACM Trans. Math. Softw. 41, 1 (2014), 5:1--5:26. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. D. H. Lehmer. 1960. Teaching combinatorial tricks to a computer. In Proc. Sympos. Appl. Math. Combinatorial Analysis, Vol. 10. 179--193.Google ScholarGoogle ScholarCross RefCross Ref
  35. G. Louchard, H. Prodinger, and S. Wagner. 2008. Joint distributions for movements of elements in Sattolo’s and the Fisher-Yates algorithm. Quaest. Math. 31, 4 (2008), 307--344.Google ScholarGoogle ScholarCross RefCross Ref
  36. J. Lumbroso. 2013. Optimal discrete uniform generation from coin flips, and applications. CoRR abs/1304.1916 (2013). http://arxiv.org/abs/1304.1916Google ScholarGoogle Scholar
  37. H. M. Mahmoud. 2003. Mixed distributions in Sattolo’s algorithm for cyclic permutations via randomization and derandomization. J. Appl. Probab. 40, 3 (2003), 790--796.Google ScholarGoogle ScholarCross RefCross Ref
  38. B. F. J. Manly. 2006. Randomization, Bootstrap and Monte Carlo Methods in Biology. Vol. 70. CRC Press.Google ScholarGoogle Scholar
  39. J. L. Massey. 1981. Collision-Resolution Algorithms and Random-Access Communications. Springer.Google ScholarGoogle Scholar
  40. L. E. Moses and R. V. Oakford. 1963. Tables of Random Permutations. Stanford University Press.Google ScholarGoogle Scholar
  41. K. Nakano and S. Olariu. 2000. Randomized initialization protocols for ad hoc networks. IEEE Trans. Parallel Distrib. Syst. 11, 7 (2000), 749--759. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. R. Neininger and L. Rüschendorf. 2004. A general limit theorem for recursive algorithms and combinatorial structures. Ann. Appl. Probab. 14, 1 (2004), 378--418.Google ScholarGoogle ScholarCross RefCross Ref
  43. V. V. Petrov. 1975. Sums of Independent Random Variables. Springer-Verlag, New York. Translated from the Russian by A. A. Brown, Ergebnisse der Mathematik und ihrer Grenzgebiete, Band 82Google ScholarGoogle Scholar
  44. R. L. Plackett. 1968. Random permutations. J. R. Stat. Soc. Ser. B. Stat. Methodol. 30, 3 (1968), 517--534. http://www.jstor.org/stable/2984255Google ScholarGoogle ScholarCross RefCross Ref
  45. B. B. Pokhodzeĭ. 1985. Complexity of tabular methods of simulating finite discrete distributions. Izv. Vyssh. Uchebn. Zaved. Mat. 7 (1985), 45--50 8 85.Google ScholarGoogle Scholar
  46. H. Prodinger. 2002. On the analysis of an algorithm to generate a random cyclic permutation. Ars Combin. 65 (2002), 75--78.Google ScholarGoogle Scholar
  47. C. R. Rao. 1961. Generation of random permutation of given number of elements using random sampling numbers. Sankhya A 23 (1961), 305--307.Google ScholarGoogle Scholar
  48. V. Ravelomanana. 2007. Optimal initialization and gossiping algorithms for random radio networks. IEEE Trans. Parallel Distrib. Syst. 18, 1 (2007), 17--28. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. E. K. Ressler. 1992. Random list permutations in place. Inform. Process. Lett. 43, 5 (1992), 271--275. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. T. Ritter. 1991. The efficient generation of cryptographic confusion sequences. Cryptologia 15, 2 (1991), 81--139. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. J. M. Robson. 1969. Algorithm 362: Generation of random permutations {G6}. Commun. ACM 12, 11 (Nov. 1969), 634--635. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. M. Sandelius. 1962. A simple randomization procedure. J. R. Stat. Soc. Ser. B. Stat. Methodol. 24, 2 (1962), pp. 472--481. http://www.jstor.org/stable/2984238Google ScholarGoogle ScholarCross RefCross Ref
  53. E. C. Titchmarsh. 1986. The Theory of the Riemann Zeta-Function (second ed.). The Clarendon Press Oxford University Press, New York.Google ScholarGoogle Scholar
  54. J. von Neumann. 1951. Various techniques used in connection with random digits. J. Res. Nat. Bur. Standards 12 (1951), 36--38.Google ScholarGoogle Scholar
  55. M. Waechter, K. Hamacher, F. Hoffgaard, S. Widmer, and M. Goesele. 2011. Is your permutation algorithm unbiased for n ≠ 2<sup>m</sup>? In Parallel Processing and Applied Mathematics. Springer, 297--306. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. S. Wagner. 2009. On tries, contention trees and their analysis. Ann. Comb. 12, 4 (2009), 493--507.Google ScholarGoogle ScholarCross RefCross Ref
  57. M. C. Wilson. 2009. Random and exhaustive generation of permutations and cycles. Ann. Comb. 12, 4 (2009), 509--520.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Generating Random Permutations by Coin Tossing: Classical Algorithms, New Analysis, and Modern Implementation

              Recommendations

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in

              Full Access

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader