To normalize:

Code:
magnitude = sqrt(x^2+y^2+z^2);
x/=magnitude;
y/=magnitude;
z/=magnitude;
This will ensure that the total length of the vector == 1.