function pmf( x, p ) {
	if (
		isnan( x ) ||
		isnan( p ) ||
		p < 0.0 ||
		p > 1.0
	) {
		return NaN;
	}
	if ( x === 0.0 ) {
		return 1.0 - p;
	}
	if ( x === 1.0 ) {
		return p;
	}
	return 0.0;
}
Evaluates the probability mass function (PMF) for a Bernoulli distribution with success probability `p` at a value `x`.

@param {number} x - input value
@param {Probability} p - success probability
@returns {Probability} evaluated PMF

@example
var y = pmf( 1.0, 0.3 );
// returns 0.3

@example
var y = pmf( 0.0, 0.3 );
// returns 0.7

@example
var y = pmf( -1.0, 0.5 );
// returns 0.0

@example
var y = pmf( 0.8, 0.5 );
// returns 0.0

@example
var y = pmf( 0.0, NaN );
// returns NaN

@example
var y = pmf( NaN, 0.5 );
// returns NaN

@example
// Invalid success probability:
var y = pmf( 1.0, 1.5 );
// returns NaN