At the moment, the spawn is totally random but I think it would be good to create even battles.
But the spawn code is veery different from yours ;)