Animating several objects randomly moving across the surface of another object
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)

(eevee)
Procedure
Emitter object
On your main shape, add a Particle System. Things to change with respect to the defaults:

Emission &gt; &quot;Frame End&quot; must be 1 (all particles emitted at the beginning of time), &quot;Lifetime&quot; as long as you like
Emission &gt; Source &gt; &quot;Emit From&quot; should be &quot;Volume&quot;
Velocity &gt; &quot;Normal&quot; should be 0
Physics &gt; Forces &gt; &quot;Brownian&quot; to some value around 3
Field Weight &gt; &quot;Gravity&quot; to 0
Render &gt; &quot;Render As&quot; to &quot;Object&quot; (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 &gt; Display as Wires in the Object properties.