I am trying to find all atoms of type A in a VASP POSCAR and then randomly add "n" atoms of type B in a sphere of radius ("r") centered at each site of type A atom using pymatgen and return each time a new POSCAR.
This isn't currently a pre-built transformation in pymatgen. You could script it yourself, by creating a new PeriodicSite, changing its position to a random vector using numpy, and appending it to the Structure.
add atoms randomly around an atom in vasp poscar using pymatgen