一、JS生成随机字符串
第一种:内置函数方法
Math.random(); //该方法产生一个0到1之间的浮点数。 延伸: Math.floor(Math.random()*10+1); //生成1-10的随机数 Math.floor(Math.random()*10);//生成0-9的随机数 函数方法: function rand ( n ) { return ( Math.floor ( Math.random ( ) * n + 1 ) ); } // 调用方法 rand(100);生成1-100的随机数。