How can i change an object position through an if statement for an object that doesn't have a script

I have a random number generated, now i want that if that number is called i move my object a 2d sprite already in the screen to a different position on the screen. the code is this:

var randomInt = Random.Range(1, 1);
if (randomInt == 1)
{
Debug.Log(“object”);

here i want to insert something to move my object mind you this script is not in the game object im targeting

at the top of your script type public GameObject objectToMove;
then in your, if statement add something along the lines of

objectToMove.transform.position = new Vector3(x,y,z);

In the inspector make sure to assign the field objectToMove by dragging the object you want to move in the slot

but im not using the object in script will it still work as im pretty new hehe.