I want a enemy to shoot player but at some constant rate.

I am trying to shoot player by enemy when enemy distance and player distance become less than some float value i want the enemy to shoot player. I calculate that distance nd even enemy started shooting player but when i used to do so in update function enemy started shooting continuously depending on the frame rate. But i want it to shoot at some constant rate. My pseudo code is like this.
If (vector3. Distance (player. Position, enemy. Position) <= minDistance) {
Instantiate (shotprefab, transform. Position, quaternion.identity)

if you want pseudo code so you can sort of figure it out yourself maybe something like this?

   // timer = 3 or a random number
   //if(timer - time.deltatime <= 0)
   //timer = 3;