How to prevent objects from interpenetrating eachother ?

So i have a bunch of objects which get some random position and i want to prevent these objects from interpenetrating eachother.
The player move around these object and when he is close it’s repositioning randomly the object.
So it is possible to precalculate a position where we are sure there is a space large enough to contain the object, depending on its scale, rotation, animation or whatever else for preventing interpenetration ?
Is there an effective and efficient way to achieve that ?

You can use a recursive function that calls itself again if the position is invalid and returns the valid position once it is found. But you will also have to limit the recursion depth, or you will get a stack overflow (function calls itself infinitely), if there is no valid position.