change generate function

change generate function