function randomWord ( randomFlag,min,max ) {
var str = " ",
range = min,
arr = [‘0‘,‘1‘,‘2‘,‘3‘,‘4‘,‘5‘,‘6‘,‘7‘,‘8‘,‘9‘,‘a‘,‘b‘,‘c‘,‘d‘,‘e‘,‘f‘];
//随机产生
if ( randomFlag ) {
range = Math.round( Math.random( ) * ( max-min)) + min;
}
for ( var i=0; i<range;i++ ) {
pos = Math.round(Math.random( ) * (arr.length-1));
str += arr [pos]
console.log( str )
return str;
}
randomWord(false,32) //220b4eac9068d368a639d62eeaf5cb59
randomWord(true,3,32) //tesa87sd34s