bench.js
function getSimiliarString(base, relation) {
	var length = Math.round(base.length * relation),
		r = '',
		i, str
	do {
		str = getRandomString(base.length - length)
	} while (str && str[0] === base[length])
	for (i = 0; i < length; i++) {
		r += base[i] // substr(...) seems to be optimized
	}
	return r + str
}
function getSimiliarString(base, relation) {
	var length = Math.round(base.length * relation),
		r = '',
		i, str
	do {
		str = getRandomString(base.length - length)
	} while (str && str[0] === base[length])
	for (i = 0; i < length; i++) {
		r += base[i] // substr(...) seems to be optimized
	}
	return r + str
}
function getSimiliarString ( base , relation ) { var length = Math . round ( base . length * relation ) , r = '' , i , str do { str = getRandomString ( base . length - length ) } while ( str && str [ 0 ] === base [ length ] ) for ( i = 0 ; i < length ; i ++ ) { r += base [ i ] // substr(...) seems to be optimized } return r + str }
Generate another string that has the same prefix and length as another one
@param {string} base
@param {number} relation A number from 0 (not equal at all) to 1 (equal strings)
@param {string}
Generate another string that has the same prefix and length as another one