How do you slow down the movement of a static body while using random number generator in 3D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dinopop

Here is my code so far and it is randomly moving at every tick of the game, but I want it to move preferably every 1 to 2 seconds:

extends StaticBody
var rng = 0

var speed = 0.5

func _process(delta):
rng = rand_range(-30.0, 30.0)

:bust_in_silhouette: Reply From: Inces

add a timer to the scene with one_shot set to false and autostart to true, connect timeoutto some method, and resolve all this movement code in this method