Simplified generate function in simlib.