How to calculate linar velocity of planet orbit? I try to simulate a solar system with planets (with random mass) placed randomly around a sun with a mass $X \times \text{solar mass}$.
The simulation is going well when I use real data (sun,earth,moon for instance), but now I'd like to simulate randomly generated system.
My problem is that I didn't succeed in calculating linear velocity of planet.
On internet, I only found formulas to calculate linear velocity when we know the angular velocity, this mean knowing the time the planet make to do a revolution , which I don't want to determine.
I want, knowing only the distance and the two mass (and direction of velocity vector), be able to calculate the linear velocity vector.
I don't really have more information to provide, if you need something, just ask for it.
 A: As mentioned in the comments, you need one more piece of information to determine the magnitude of the velocity.  
You said that you might use the eccentricity, so in that case you can use the formula given here and deduce a quadratic equation on the velocity which yields:
$$ v= \sqrt{\frac{G M}{r \sin(\alpha)} (1 \pm \epsilon)}, $$
where $G$ is the gravitational constant, $r$ is the distance between the two masses, $M$ is the bigger mass (I assumed here that one mass is much bigger than the other), $\alpha$ is the angle between the velocity vector and the radius, and $\epsilon$ is the eccentricity.
Note that since we had a quadratic equation, you still have two options for the velocity, both consistent with the given eccentricity.
A: I assume that you want to have stable orbits. Then you know that the centrifugal force equals the gravitational force:
GmM/r² = mv²/r
with G = Newtons constant, r the distance and m the mass of the planet and M the mass of the central object. Since you know the distance and the mass of the central object (the mass of the planet cancels out) you can calculate v.
v² =GM/r 
