random wait times

is it possible to in an event set it so that there is a random wait before the next past of the event goes off (for example a thunderclap or flash of lightning id there is a storm happening)
not in the wait command, but you can have a variable set to random and then count down in a loop with a wait.
JavaScript:
// Replace Max with the maximum number of frames you want to wait.
// Replace Min with the minimum number of frames you want to wait.

var frames = (Math.floor((Math.random() * Max) + Min));
this.wait(frames);

You can put that in a script call in any event to make it wait a random number of frames.
thank you I figured someone on here would be able to answer my query

Original thread: https://forums.rpgmakerweb.com/threads/random-wait-times.119575/