I do not understand your question.

The interaction force between any two particles are model with relation: \vec{F}=-\frac{GMm}{r}\hat{r} where r is the distance between any two particles. (because it is 2D model so force is proportional to 1/r).
The gravitationf force should be model with \vec{F}=-\frac{GMm}{r^2}\hat{r} for 3D simulation.
And particles are generated at random position with random velocity.