'use strict';

var sample = require( './../lib' );

var out;
var x;

// By default, sample uniformly with replacement:
x = [ 'a', 'b', 'c', 'd' ];
out = sample( x, {
	'size': 10
});
console.log( 'By default, sample uniformly with replacement:\n%s', out.toString() );

// Sample with replacement with custom probabilities:
x = [ 'a', 'b', 'c', 'd' ];
out = sample( x, {
	'probs': [ 0.1, 0.1, 0.2, 0.6 ],
	'size': 10
});
console.log( 'Sample with replacement with custom probabilities:\n%s', out.toString() );

// Sample without replacement:
x = [ 'a', 'b', 'c', 'd' ];
out = sample( x, {
	'size': 3,
	'replace': false
});
console.log( 'Sample without replacement:\n%s', out.toString() );

// Sample without replacement when (initial) probabilities are non-uniform:
x = [ 1, 2, 3, 4, 5, 6 ];
out = sample( x, {
	'probs': [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.5 ],
	'size': 3,
	'replace': false
});
console.log( 'Sample without replacement with custom probabilities:\n%s', out.toString() );

'use strict';

var sample = require( './../lib' );

var out;
var x;

// By default, sample uniformly with replacement:
x = [ 'a', 'b', 'c', 'd' ];
console.log( 'By default, sample uniformly with replacement:' );
out = sample( x, {
	'size': 10
});
console.log( out );

// Sample with replacement with custom probabilities:
x = [ 'a', 'b', 'c', 'd' ];
console.log( 'Sample with replacement with custom probabilities:' );
out = sample( x, {
	'probs': [ 0.1, 0.1, 0.2, 0.6 ],
	'size': 10
});
console.log( out );

// Sample without replacement:
x = [ 'a', 'b', 'c', 'd' ];
console.log( 'Sample without replacement:' );
out = sample( x, {
	'size': 3,
	'replace': false
});
console.log( out );

// Sample without replacement when (initial) probabilities are non-uniform:
x = [ 1, 2, 3, 4, 5, 6 ];
console.log( 'Sample without replacement (with custom probabilities):' );
out = sample( x, {
	'probs': [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.5 ],
	'size': 3,
	'replace': false
});
console.log( out );

--- 
+++ 
@@ -7,36 +7,32 @@
 
 // By default, sample uniformly with replacement:
 x = [ 'a', 'b', 'c', 'd' ];
-console.log( 'By default, sample uniformly with replacement:' );
 out = sample( x, {
 	'size': 10
 });
-console.log( out );
+console.log( 'By default, sample uniformly with replacement:\n%s', out.toString() );
 
 // Sample with replacement with custom probabilities:
 x = [ 'a', 'b', 'c', 'd' ];
-console.log( 'Sample with replacement with custom probabilities:' );
 out = sample( x, {
 	'probs': [ 0.1, 0.1, 0.2, 0.6 ],
 	'size': 10
 });
-console.log( out );
+console.log( 'Sample with replacement with custom probabilities:\n%s', out.toString() );
 
 // Sample without replacement:
 x = [ 'a', 'b', 'c', 'd' ];
-console.log( 'Sample without replacement:' );
 out = sample( x, {
 	'size': 3,
 	'replace': false
 });
-console.log( out );
+console.log( 'Sample without replacement:\n%s', out.toString() );
 
 // Sample without replacement when (initial) probabilities are non-uniform:
 x = [ 1, 2, 3, 4, 5, 6 ];
-console.log( 'Sample without replacement (with custom probabilities):' );
 out = sample( x, {
 	'probs': [ 0.1, 0.1, 0.1, 0.1, 0.1, 0.5 ],
 	'size': 3,
 	'replace': false
 });
-console.log( out );
+console.log( 'Sample without replacement with custom probabilities:\n%s', out.toString() );
Move and consolidate log statements
