How to randomise object facing upon button down (using raycast to detect cursor over object)

This is my first time using this site, also im am quite a noob lol.
Basically i am using a ray cast in conjunction with a button down to cause a primitive to change direction. i want to randomize the directions of the x and z axis upon button down over the object, but cant figure out how.

Here is what i have so far

var CubePosition : Transform;
public var theCube : GameObject;

function Start () {

}

function Update () {

var hit : RaycastHit ; 
var ray:Ray = Camera.main.ScreenPointToRay(Input.mousePosition);


if (Physics.Raycast (ray,hit,100)){
    Debug.DrawLine(ray.origin,hit.point);



    
    
    Debug.Log("hit");
    
if(Input.GetButtonDown("Fire1") && hit.collider.gameObject.name == "theCube"){
     
    /*here is where i want to randomize where my "box primitive is facing, as upon pressing the button, i would like the object to randomly face either the z+ or -, or the x + or -"
    
    
    
    
    }
}

}

i just cant figure out how, and any help would be greatly appreciated, thanks in advance.

Well the Random.Range(0,4) function will return 0, 1, 2 or 3 randomly. So in your code you can have a switch statement that takes one of 4 paths, and rotates the game object to face on of those directions. You might use Vector3.Slerp() for the actual rotation.