Artificial intelligent assistant

Random 4D vector I'd like to generate random 4D vectors. Their length must be 1. A random 2D vector can be created like so: vec[0] = sin(rand1 * PI * 2) vec[1] = cos(rand1 * PI * 2) A random 3D vector can be created like so: vec[0] = sin(rand1 * PI * 2) * cos(rand2 * PI * 2); vec[1] = cos(rand1 * PI * 2) * cos(rand2 * PI * 2); vec[2] = sin(rand2 * PI * 2); (rand1 and rand2 are random numbers between 0 and 1) How can you make a random 4D vector in the same manner. Would it be possible to some how combine two 2D vectors?

There are many ways to do this. One is given here: <

Summary: Generate $x_1,\dots,x_4$ using the standard normal distribution (often built-in) and normalize the vector $[x_1,\dots,x_4]$ to have unit length.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy ed5964c568720c0f4b7e4639254a9f80