In this paper, the optimal design of multiple tuned mass dampers (MTMDs) is performed to mitigate the seismic response of structures when considering the earthquake excitation as a random process. Frequency-domain analysis of the structure is performed according to random vibration theory in order to establish a new optimization problem in terms of the parameters of tuned mass dampers (TMDs) as design variables. In this regard, a semi-analytical formulation is developed for the random earthquake response of structures equipped with tuned mass dampers, which is highly efficient for each objective function evaluation needed for optimal design. Hence, the present formulation renders an effective optimization problem for the rapid design of MTMDs under earthquake loading. Minimization of the maximum standard deviation of structural response is proposed as an objective function, while some constraints are defined for the parameters and response of TMDs. Five well-known metaheuristic methods including particle swarm optimization, whale optimization algorithm, grey wolf optimizer, water evaporation optimization, and bat algorithm are employed for solving the proposed optimization problem. A comprehensive design example is considered based on a ten-story building frame, which demonstrates the efficiency and capability of the proposed random vibration-based problem for optimal design of MTMDs. The optimized TMDs are also verified with response history analysis in the time domain using several seismic ground motions.