generating the pattern