Q: How Do I Choose Randomly From A Set Of Actions so I am currently working on a enemie that free roams and moves around to random spots by itself.to do this I plan to have it choose from a set up possible directions it can go like here:
How Do I Choose Randomly From A Set Of Possible Actions(Increasing Y,IncreasingX,ETC)
Feed Back is Always Appreciated ;)

A: I would do like:
int actions = Random.Range(0,2);

(The last number does not appear, note that the possibility here is to give two possible random outcomes: "0 or 1". - if you want "0, 1 or 2" put Random.Range(0,3); and so on)
More about Random Range
And checking it out with switch statement - it will trigger the exact action sorted in the int actions :)
switch(actions){
case 0:
//do thing1
break;

case 1:
//do thing 2
break;

default:
//do nothing
break;

}


A: A generic way would be to store an array of functions, and use a random value to index the array to select which function to perform. 
Something like this:
Random rand = new Random();
Action[] actions = {
    () => { x += 1; y += 1; },
    () => { x += 1; }
    //...
};
actions[rand.Next(actions.Length)]();

This however can be quite tedious, but has some advantages. For example, the set of possible actions can change dynamically.
In this case, if you're only concerned about selecting a random vector from a static set, you really only need to select a random deltaY and deltaX, where dX and dY are { -1, 0, 1 } 
Random rand = new Random();

int dY = rand.Next(-1, 2);
int dX = rand.Next(-1, 2);

x += dx;
y += dy;


A: Random rand = new Random();

int direction;

Vector3[] Directions = { // front, back, left, right and diagonal positions

    new Vector3( 1 , 0 , 0 ),

    new Vector3( -1 , 0 , 0 ),

    new Vector3( 0 , 1 , 0 ),

    new Vector3( 0 , -1 , 0 ),

    new Vector3( 1 , 1 , 0 ),

    new Vector3( -1 , -1 , 0 ),

    new Vector3( 1 , -1 , 0 ),

    new Vector3( -1 , 1 , 0 )

}

public Vector3 ChooseRandome(){

   direction = rand.Next( Directions.length ); // Random number with directions.length as max possible number

   return Directions[randomIndex]; // plug random number in and return index.

}


A: What you want to do is make a random number generator that generates a random number from 1 to 8, and each number represents a direction. It is something like this:
Random rand = new Random();
int direction;

void OnUpdate() {
    direction = rand.Next(1, 9);
    if (direction == 1) {
        moveLeft();
    }
    else if (direction == 2) {
        moveRight();
    }
    ...
}

I am very sorry if I confuse a language with c# since I didn't do unity for a while :)
