class_name RandomTimer extends Timer
## A Timer variant that randomizes the timer interval

## Average timer interval, in seconds
@export var mean_time := 1.0
## Standard deviation of timer interval, in seconds
@export var st_dev_time := 0.2
## Minimum timer interval, in seconds
@export var minimum_time := 0.0

var _rng := RandomNumberGenerator.new()


func _ready() -> void:
	timeout.connect(_on_timeout)


func _on_timeout() -> void:
	wait_time = max(minimum_time, _rng.randfn(mean_time, st_dev_time))
