Creating Emeny random spawn and spawn timer

Hi! as the title says, how can I make a random spawn for the enemy, and when it dies it will have a timer before it will re-spawn again. Thanks!
For a random spawn, what I would do is to randomize a variable (between 1 and 5 for exemple), and do something like this :


if variable == 1{


 teleport to spawn 1


} else if variable == 2 {


 teleport to spawn 2


} else if...etc


for the respawning timer, there is tutorials on internet. Ask google =)

Original thread: https://forums.rpgmakerweb.com/threads/creating-emeny-random-spawn-and-spawn-timer.70476/