How to make passive ai movement

I’m making a game and I need ai characters to move around randomly in the Z axis. At the moment, this is my code.

transform.Rotate (0, 0, Random.Range-1f, 1f));

However, when I press play they all just go in circles. please help me get them to move around naturally and randomly like passive dinosaurs on ARK.

transform.Rotate() will make them rotate, so they will go in circles. transform.Translate() will make them move. To have them wander around you need to write a code that switches between the two.

You could also place empty gameobjects in your scene and let your AI decide randomly which gameobject to move to. This almost looks like random wandering like in ARK. But if you need help there are many good tutorials on YouTube about this topic.