Function generator.