We numerically investigate the implementation of Haar-random unitarity transformations and Fourier transformations in photonic devices consisting of beam splitters and phase shifters, which are used for integrated photonics implementations of boson sampling. The distribution of reflectivities required to implement an arbitrary unitary transformation is skewed towards low values, and this skew becomes stronger the larger the number of modes. A realistic implementation using Mach-Zehnder interferometers is incapable of doing this perfectly and thus has limited fidelity. We show that numerical optimisation and adding extra beam splitters to the network can help to restore fidelity.