Need help with randomiser

So i’m not gonna lie, I’m totally new to Unity and I was never really good at programming but I managed to scrape up this code from lurking a bit.

using UnityEngine;
using System.Collections;
public class ExampleBehaviourScript : MonoBehaviour {

    // Use this for initialization
    void Start () {
   
    }
   
    // Update is called once per frame
    void Update () {

        if (myInt <= 50) {
gameObject.transform.position = new Vector3 (2, 2, 2);
                } else {
            gameObject.transform.position = new Vector3 (0, 0, 0);
                }
    }
}
int myInt = Random.Range (1, 101);

It’s probably garbage but what I hope to be able to do is make a simple oculus rift game, where you as the player walks around an environment and picks up certain objects by clicking them. I want to pre set possible positions(locations) for for the objects in which the code will choose from as it makes its random decision.
So when the game starts the objects will be randomly placed according to the pre set possible locations.
Because of the Void Update the code doesnt work (obviously), but I cant put it anywhere else. Any help would be greatly appreciated.

Do it all in Start

int myInt;

    void Start () {
        myInt = Random.Range (1, 101);
        if (myInt <= 50) {
             gameObject.transform.position = new Vector3 (2, 2, 2);
        } else {
             gameObject.transform.position = new Vector3 (0, 0, 0);
        }
    }
1 Like

Awesome thanks