Different ways of generating function