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.

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.