My approach would be using a particle generator. But the only ones I know are for 3D images.
So I would use Blender, where you can define the number of particles.
As you need to change the color of some of them I would create two base objects (an object is the shape of the particle that will be repeated) to make two particle systems.
One system with 162 and the other with 588.
Then I would choose a self illuminated material for the particles and the container so my final render looks flat.
If you need a "white" separation you can prepare a fresnel material. This makes the material look one color if the angle is paralel to the camera and the color changes if the angle of this surface changes.
Look for a specific tutorial on how to achieve this: https://www.google.com/search?q=blender+particle+systems
To be sure you have the exact amount of particles generate a lower number of them so you can count them and confirm.
If you "drop" them form some height you will have some randomness in the distribution.
You can render this of a decent size. But if you leave a gap between the circles you could try to trace them.
Another way to do it is using the "Spray" tool inside of Illustrator.
The basic idea is that you prepare a symbol of a circle, choose the spray tool and... spray.
At any moment you can select all the objects in one layer to make an automated counting. (Document info)
You could prepare different layers lets say each with 50 objects so you can keep track on how many objects are there.
The drawback of this method is that some circles can be overlapped one on top of another.