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:
##Procedure
###Emitter object
On your main shape, add a Particle System. Things to change with respect to the defaults:
- Emission > Frame End must be 1, Lifetime as long as you like
- Emission > Source > Emit From should be Volume
- Velocity > Normal should be 0
- Physics > Forces > Brownian to some value around 3
- Field Weight > Gravity to 0
- 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 T toolshelf) and fatten it a bit. Then invert its normals: CtrlShiftN so that they point inwards.
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.