generate patterns