Python coding...
You can easily access the elements in a structure with configuration.elements(), that gives a list of the elements, you can then use the random.random() function to pick indices in a relevant way, replace an element and then put it back into the configuration with the secret method configuration._changeAtoms(elements=new_elements).
Or you can just remake the configuration from it's old parts:
new_configuration = BulkConfiguration(old_configuration.bravaisLattice(), new_elements, old_configuration.cartesianCoordinates())