patterns generation