generating Min and Max