# Efficiently rotate vector in 2D (and 3D)

I need to efficiently rotate a 2D (and 3D) vector in a CUDA kernel. I was thinking about generating random unitary rotation matrices. I don't need to know the angle, it just has to be randomly distributed.

Is there some clever way to avoid the computational complexity of the division and the square root for the norm? Or another way to rotate a vector?

I need this for a 2D GPU off-lattice Monte-Carlo simulation, but a 3D solution would be nice too.

Some of the standard methods for random rotations in 3D (Sphere Point Picking) are listed on Mathworld. On a CPU, Marsaglia's method is quite efficient, because it avoids expensive $\sin$ and $\cos$ computations.