Use two objects: your shape (are they $s$ and $p$ atomic orbitals?) to generate particles, and a *fattened* version of it to contain them.

Result:

[![workbench][1]][1]

(workbench)

[![eevee][2]][2]

(eevee)

## Procedure

### Emitter object

On your main shape, add a *Particle System*. Things to change with respect to the defaults:

1. *Emission* > "*Frame End*" must be 1 (all particles emitted at the beginning of time), "*Lifetime*" as long as you like
2. *Emission* > *Source* > "*Emit From*" should be "*Volume*"
3. *Velocity* > "*Normal*" should be 0
4. *Physics* > *Forces* > "*Brownian*" to some value around 3
5. *Field Weight* > "*Gravity*" to 0
6. *Render* > "*Render As*" to "*Object*" (then select a UVSphere to duplicate)

### Container object

Duplicate your main object, and remove the Particle System from the duplicate.

In *Edit Mode*, use the *Shrink/Fatten* tool (you can find it using *Search* or in the <kbd>T</kbd> toolshelf) and fatten it a bit. Then invert its normals: <kbd>Ctrl</kbd><kbd>Shift</kbd><kbd>N</kbd> so that they point *in*wards.

In the *Physics* panel, activate *Collision*. Default parameters work well.

Since this is an helper object, you may want to restrict its *render visibility* in the Outliner, and to make its *Viewport Display* > *Display as Wires* in the Object properties.


  [1]: https://i.sstatic.net/ecuaw.gif
  [2]: https://i.sstatic.net/KNuyX.gif