Random qubit unitary distributed over the Haar measure.

The implementation is vectorized for speed.

shape The broadcasted shape of the output. This is used to generate a tensor of random unitaries with dimensions tuple(shape) + (2,2).
randomize_global_phase (Default False) If True, a global phase is also sampled randomly. This corresponds to sampling over U(2) instead of SU(2).
rng Random number generator to be used in sampling. Default is numpy.random.