## 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 nlog_{2} n+ O(1) time, is in-place, uses nlog_{2} n+ Θ(n) random bits, and can be parallelized across any number of processes, in a shared-memory PRAM model. Finally, our preliminary simulations using OpenMP^{1}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.

Original language | English (US) |
---|---|

Pages (from-to) | 43-52 |

Number of pages | 10 |

Journal | CEUR Workshop Proceedings |

Volume | 2113 |

State | Published - Jan 1 2018 |

Event | 11th International Conference on Random and Exhaustive Generation of Combinatorial Structures, GASCom 2018 - Athens, Greece Duration: Jun 18 2018 → Jun 20 2018 |

## All Science Journal Classification (ASJC) codes

- Computer Science(all)