MergeShuffle: A very fast, parallel random permutation algorithm

Axel Bacher, Olivier Bodini, Alexandros Hollender, Jérémie Lumbroso

Research output: Contribution to journalConference articlepeer-review

3 Scopus citations


This article introduces an algorithm, MERGESHUFFLE, which is an extremely efficient algorithm to generate random permutations (or to randomly permute an existing array). It is easy to implement, runs in nlog2 n+ O(1) time, is in-place, uses nlog2 n+ Θ(n) random bits, and can be parallelized across any number of processes, in a shared-memory PRAM model. Finally, our preliminary simulations using OpenMP1suggest it is more efficient than the Rao-Sandelius algorithm, one of the fastest existing random permutation algorithms. We also show how it is possible to further reduce the number of random bits consumed, by introducing a second algorithm BALANCEDSHUFFLE, a variant of the Rao-Sandelius algorithm which is more conservative in the way it recursively partitions arrays to be shuffled. While this algorithm is of lesser practical interest, we believe it may be of theoretical value.

Original languageEnglish (US)
Pages (from-to)43-52
Number of pages10
JournalCEUR Workshop Proceedings
StatePublished - 2018
Event11th International Conference on Random and Exhaustive Generation of Combinatorial Structures, GASCom 2018 - Athens, Greece
Duration: Jun 18 2018Jun 20 2018

All Science Journal Classification (ASJC) codes

  • General Computer Science


Dive into the research topics of 'MergeShuffle: A very fast, parallel random permutation algorithm'. Together they form a unique fingerprint.

Cite this