HackerPapers

arXiv:1508.03167cs.DS

MergeShuffle: A Very Fast, Parallel Random Permutation Algorithm

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

HN submission. Found in a submission link or body. Submitters do not count as commenters in the main ranking; a submission is not an endorsement.

Abstract

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 $n\log_2 n + O(1)$ time, is in-place, uses $n\log_2 n + Θ(n)$ random bits, and can be parallelized accross any number of processes, in a shared-memory PRAM model. Finally, our preliminary simulations using OpenMP suggest 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. Our full code is available at: https://github.com/axel-bacher/mergeshuffle

arXiv comments
Preliminary draft. 12 pages, 1 figure, 3 algorithms, implementation code at https://github.com/axel-bacher/mergeshuffle
Journal reference
DOI
Subjects
cs.DSData Structures and Algorithms cs.DMDiscrete Mathematics

On Hacker News

No comments linking this paper were found in the collected sources. Found in 1 HN submission from Aug 2015 to Aug 2015. Open submission discussions.

Comments linking this paper, per year.

Discussed in comments0 threads

No comments linking this paper were found in the collected sources. Open submission discussions.

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.