Random rotation script

Hello!
I’m making clone of popular “knife hit” Knife Hit (Ketchapp) - YouTube game to study Unity and get to a moment where I cannot get rotation of a goal object which should behave randomly: several seconds with some speed it rotates clockwise then counterclockwise for several seconds. I got to a part where I have a private class with Speed and Duration variables and then I have array that holds these two variables but I cannot rotate goal as needed. Could you please advice where to look to figure out how to write such things.
Thanks!

Hello Pavel.Actually I have never tried somethink like this but I have some ideas about algorithm .In my thinking you can write these code with this following steps

1-First of all we need to add rotating script.For that we can use Transform.Rotate method.

transform.Rotate(new Vector3(1,0,0)*Time.deltaTime*speed);

In here we will change rotation speed and rotation direction with speed value.

2-We need to change speed and waiting time.We will use waiting time for changing direction and speed.For that I wrote somethink like that

if (isReadyForNextTime == true)
        {
            isReadyForNextTime = false;
            speed = Random.Range(-100, 100);
            waitTime = Random.Range(5, 10);
            Invoke("ChangeValues",waitTime);
        }

In here first of all unity will check if function if it is true it will false bool value then generate different random waiting time and speed after that Invoke a new function which will make bool value to true.I hope I expressed my self good =).

Have a great day

Great, thank you very much this works!!!