I am writing a computer program to simulate orbiting bodies such as planets and stars.
I wish to have a starting point in which a number of bodies are randomly scattered around a central heavy body. Each body (except the central one) is sent off at the correct orbiting velocity but in a random direction. I am using an x,y,z coordinate system. For each orbiting body, I can establish the starting position and orbiting velocity.
I want each orbiting body to start moving in a random direction (but on the right plane) for which I need to calculate the initial x, y and z velocity components. This bit I cannot figure out how to do. Does anyone have any suggestions?
Do I correctly restate your question as : "I want to get a vector of random orientation in the plane, but with a given magnitude" ? Then you should take an angle according to a uniform distribution in $[0, 2\pi)$, and then calculate $x$ and $y$ components with the magnitude you want to impose.