Based on a single mode distributed non-stationary model of the gyrotron, we investigate the influence of the non-uniformity of the guiding magnetic field on the processes of rogue-wave generation. We estimate the allowable level of non-uniformity at which the statistical properties of the system are retained. 3D PIC simulations of a Ka-band gyrotron fully verify the theoretical predictions.