Skip to content
HTQHow To Quant
← Problem Bank

Random Permutation

CalcMedium~15 min· Algorithms
Problem

Given an array of distinct elements, generate a uniformly random permutation — every one of the orderings must be equally likely. You have access to a function randint(a, b) returning a uniform integer in .

Describe an algorithm and prove it is uniform.