function factory( sigma ) {
	if ( isnan( sigma ) || sigma < 0.0 ) {
		return constantFunction( NaN );
	}
	return mgf;

	/**
	* Evaluates the moment-generating function (MGF) for a Rayleigh distribution.
	*
	* @private
	* @param {number} t - input value
	* @returns {number} evaluated MGF
	*
	* @example
	* var y = mgf( 0.5 );
	* // returns <number>
	*/
	function mgf( t ) {
		var sigmat;
		var ret;

		if ( isnan( t ) ) {
			return NaN;
		}
		sigmat = t * sigma;
		ret = 1.0 + (sigmat * exp( sigmat*sigmat / 2.0 ));
		ret *= SQRT_HALF_PI * ( erf( sigmat / SQRT2 ) + 1.0 );
		return ret;
	}
}
Returns a function for evaluating the moment-generating function (MGF) of a Rayleigh distribution with scale parameter `sigma`.

@param {NonNegativeNumber} sigma - scale parameter
@returns {Function} MGF

@example
var mgf = factory( 0.5 );
var y = mgf( 1.0 );
// returns ~2.715

y = mgf( 0.5 );
// returns ~1.888