Various algorithm to generate patterns