JavaScript - Make people move around randomly

Hi there, I want to create people that move around randomly. I now have

 var chicken : Transform; 
 var vel : Vector3;
 var Direction : float = 3;
 var curTime : float = 0;
 
 function Start() {
	SetVel();
}

function SetVel() {
	if (Random.value > .5) {
		vel.x = 5 * 5 * Random.value;
	}
	else {
		vel.x = -5 * 5 * Random.value;
	}
	
	if (Random.value > .5) {
		vel.z = 5 * 5 * Random.value;
	}
	else {
		vel.z = -5 * 5 * Random.value;
	}
 }
 
 function Update() {
	SetVel();
	if (Random.value > .5) {
		Direction += Random.value;
	}
 
	else {
		Direction -= Random.value;
	}
	
	if (Direction < 1) {
		Direction = 1 + Random.value;
	}
	curTime = 0;
}

function FixedUpdate() {
	chicken.GetComponent.<Rigidbody>().velocity = vel;
	}

but this just makes people (I’m using a cube for testing purposes) move around really shaky. Is there a way to make it more clean/smooth?

For simple, random, idle movement, you could try dividing their actions into groups. For example, you could choose a destination, walk towards it, then stop using coroutines (whether they should reach their destination or not is up to you).

private var isWalking: boolean;

function Start()
{
	isWalking = false;
	StartCoroutine(Wander());
}

function Wander()
{
	while(true) // Loop forever
	{
		var randomTime: float // Customize times using variables
		randomTime = Random.Range(1.0, 3.0); // Time spent walking
		// Set velocity/destination/whatever here
		isWalking = true;
		yield WaitForSeconds(randomTime);
		randomTime = Random.Range(1.0, 3.0); // Time spent waiting
		isWalking = false;
		yield WaitForSeconds(randomTime);
	}
}

function FixedUpdate()
{
	if(isWalking)
	{
		chicken.GetComponent.<Rigidbody>().velocity = vel
	}
}

I apologize for any typos, this is all untested, written in place.