A Distributed Control Algorithm for Small Swarms in Cordon and Patrol