function factory( p ) {
	if ( isnan( p ) || p < 0.0 || p > 1.0 ) {
		return constantFunction( NaN );
	}
	return quantile;

	/**
	* Evaluates the quantile function for a Bernoulli distribution.
	*
	* @private
	* @param {Probability} r - input value
	* @returns {NonNegativeInteger} evaluated quantile function
	*
	* @example
	* var y = quantile( 0.3 );
	* // returns <number>
	*/
	function quantile( r ) {
		if ( isnan( r ) || r < 0.0 || r > 1.0 ) {
			return NaN;
		}
		if ( r <= 1.0 - p ) {
			return 0;
		}
		return 1;
	}
}
Returns a function for evaluating the quantile function for a Bernoulli distribution with success probability `p`.

@param {Probability} p - success probability
@returns {Function} quantile function

@example
var quantile = factory( 0.4 );
var y = quantile( 0.4 );
// returns 0

y = quantile( 0.8 );
// returns 1

y = quantile( 1.0 );
// returns 1