added random selection of bases between 1 and n-1