Most research on moving target defense has focused on how to efficiently change the IP address and the method of IP address replacement, and there have been few studies on the address-changing frequency, making it difficult for a user to decide the appropriate frequency for the system. According to previous research, the higher the address-changing frequency, the higher the system security at the expense of the performance of the server and the utilization of system resources. In this paper, we propose a method for quantifying the security of a moving target defense system that allows the user to decide the address-changing frequency in moving target defense. We show how to achieve the balance between security and system resource use by employing a stochastic process. Our research makes the moving target defense system operate more efficiently in industrial control systems.