src/generate.js
function(max) {
	// gives a number between 0 (inclusive) and max (exclusive)
	var rand = crypto.randomBytes(1)[0];
	while (rand >= 256 - (256 % max)) {
		rand = crypto.randomBytes(1)[0];
	}
	return rand % max;
}
function(max) {
	// gives a number between 0 (inclusive) and max (exclusive)
	var rand = crypto.randomBytes(1)[0];
	while (rand >= 256 - (256 % max)) {
		rand = crypto.randomBytes(1)[0];
	}
	return rand % max;
}
function ( max ) { // gives a number between 0 (inclusive) and max (exclusive) var rand = crypto . randomBytes ( 1 ) [ 0 ] ; while ( rand >= 256 - ( 256 % max ) ) { rand = crypto . randomBytes ( 1 ) [ 0 ] ; } return rand % max ; }
Generates a random number
Generates a random number