make a generator func.