Implement an in-place function shuffle(arr) in JavaScript that returns a uniformly random permutation of the input array. The algorithm must be unbiased (all n! permutations equally likely), run in O(n) time with O(
extra space, and handle empty or single-element arrays. Explain your approach, justify uniformity at a high level, and analyze time and space complexity.