'use strict';

var randu = require( '@stdlib/math/base/random/randu' );
var round = require( '@stdlib/math/base/special/round' );
var pmf = require( './../lib' );

var i;
var n;
var p;
var x;
var y;

for ( i = 0; i < 10; i++ ) {
	x = round( randu() * 20 );
	n = round( randu() * 100 );
	p = randu();
	y = pmf( x, n, p );
	console.log( 'x: %d, n: %d, p: %d, P(X = x;n,p): %d',
		x,
		n,
		p.toFixed( 4 ),
		y.toFixed( 4 )
	);
}

'use strict';

var randu = require( '@stdlib/math/base/random/randu' );
var round = require( '@stdlib/math/base/special/round' );
var pmf = require( './../lib' );

var i;
var n;
var p;
var x;
var y;

for ( i = 0; i < 10; i++ ) {
	x = round( randu() * 20.0 );
	n = round( randu() * 100.0 );
	p = randu();
	y = pmf( x, n, p );
	console.log( 'x: %d, n: %d, p: %d, P(X = x;n,p): %d', x, n, p.toFixed( 4 ), y.toFixed( 4 ) );
}

Add decimals