:We investigate the local distribution of roots of random functions of the form $F_n(z)=\sum_{i=1}^n\xi_i\phi_i(z)$, where $\xi_i$ are independent random variables and $\phi_i(z)$ are arbitrary analytic functions. Starting with the fundamental works of Kac and Littlewood-Offord in the 1940s, random functions of this type have been studied extensively in many fields of mathematics.We develop a robust framework to solve the problem by reducing, via universality theorems, the calculation of the distribution of the roots and the interaction between them to the case where $\xi_i$ are Gaussian. In this special case, one can use the Kac-Rice formula and various other tools to obtain precise answers.Our framework has a wide range of applications, which include the most popular models of random functions, such as random trigonometric polynomials and all basic classes of random algebraic polynomials (Kac, Weyl, and elliptic). Each of these ensembles has been studied heavily by deep and diverse methods. Our method, for the first time, provides a unified treatment for all of them.Among the applications, we derive the first local universality result for random trigonometric polynomials with arbitrary coefficients. When restricted to the study of real roots, this result extends several recent results, proved for less general ensembles. For random algebraic polynomials, we strengthen several recent results of Tao and the second author, with significantly simpler proofs. As a corollary, we sharpen a classical result of Erd\"{o}s and Offord on real roots of Kac polynomials, providing an optimal error estimate. Another application is a refinement of a recent result of Flasche and Kabluchko on the roots of random Taylor series.