function str_rand() { var result = '', words = '1234567890qwertyuioplkjhgfdsazxcvbnm'; for( var i = 0; i < 6; ++i ) { result += words.charAt( Math.floor( Math.random() * words.length ) ); } return result; }