In this paper, an optimization procedure for synthesizing shaped beams with an arbitrary geometry phased array system with real-time capability is presented. The algorithm involves a combination of an arbitrary extension of the Woodward-Lawson synthesis procedure with the magnitude least-squares optimization method. This simple combination significantly reduces the optimization time, enabling real-time beam shaping in response to changing requirements on beam shape or evolving geometry in distributed arrays. The technique places no restrictions on element positioning in all three spatial dimensions and is demonstrated to accurately reproduce the desired beam shape in both angular dimensions. The algorithm is demonstrated for multiple beam cases with a large, randomly generated array in computational simulation. The applicability of the algorithm to practical phased array hardware is also demonstrated using full-wave electromagnetic simulations and measurements of a realized arbitrary phased array system using a near-field scanner in an anechoic chamber.