function randomString(len) {
len = len || 32;
var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; /**** The confusing characters are removed by default oOLl,9gq,Vv,Uu,I1****/
var maxPos = $chars.length;
var pwd = '';
for (i = 0; i < len; i++) {
pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
}
return pwd;
}

JS More articles on generating random strings

  1. JS There are many ways to generate random strings

    This article mainly introduces JS Methods of generating random strings , Friends in need can refer to Here's a piece of code , When tidying up the computer , Record for reference . <script language="javascript"> ...

  2. js Generate random strings or random numbers

    // Returns a random number within a specified range function createRandomNum(Min,Max){ let Range = Max - Min; let Rand = Math.random(); ...

  3. 【 Share 】JS Generate random string

    I forgot where to find a piece of code before , When tidying up the computer , The record is for reference , Original is not me . function randomString(len) { len = len || 32; var $chars = 'ABCD ...

  4. JS Generate random string Random color

    Use Math.random() Generate random number 0.7489584611780002 Digital .toString(n) Convert numbers to n Base string n Value range (0~36)"0.vbpjw8lipf ...

  5. js A simple way to generate random fixed length strings

    summary Meet a need : use js Generate a fixed length string . I checked a lot of information on the Internet , Online methods are quite troublesome . I had an idea of myself , A relatively simple method is realized . recorded , For future development reference , I believe it works for others . js Generate random string ...

  6. .net Generate random string

    Tool class for generating random strings : /// <summary> /// Random string tool class /// </summary> public class RandomTools { /// &l ...

  7. js Generate random strings

    js Generate random strings /* *js Generating random strings is so simple *toString() radix argument must be between 2 and 36 */ function uuid() ...

  8. PHP Generate random strings and unique strings

    explain : The methods used to generate random strings are mt_rand() The methods used to generate unique strings are md5(),uniqid(),microtime() Code : <?php /* * Generate random string * @par ...

  9. PHP Generate random strings, including uppercase and lowercase letters

    PHP Generate random strings, including uppercase and lowercase letters , Here are two approaches : The first one is : Using string function operation <?php /** *@blog <www.phpddt.com> */ function cre ...

Random recommendation

  1. javascript Sports frame

    The following motion framework controls the motion of an element on an attribute , meanwhile , You can call the callback function . /* Get the value of an attribute of an element @obj: object @attr: Property value */ function getStyle(obj, a ...

  2. ES6 Of Iterator,jquery Fn

    ES6 Of Iterator Object details Iterator Realization principle Create a pointer object , Point to the start of the current data structure . in other words , Ergodic objects are essentially , It's a pointer object . The first call to the next Method , You can point the pointer to ...

  3. Introduction to electronic production of bread board (class1) video full set 30 Set HD

    Introduction to electronic production of bread board (class1) Kit (30 Set HD ) This kit uses the most basic components in electronic production to build circuits on the bread board , Use inspiring video teaching methods , Make learners familiar with the fundamentals of electronic circuits . Use your imagination . Learn to design and make independently in creative design and production ...

  4. [JavaScript]JS Yes select dynamic options operation [IE&amp;FireFox compatible ]

    <select id="ddlResourceType" onchange="getvalue(this)"></select>     ...

  5. javascript in bind,apply,call The similarities and differences of

    javasctipt in bind,apply,call The same thing is : 1, It's all about changing this The direction of ; 2, All parameters can be transferred through subsequent parameters ; 3, The first parameter is to specify this Object to point to ; Difference : 1, The caller ...

  6. PL/SQL Block

    DECLARE BARCODE VARCHAR(50); BEGIN BARCODE := 'A'; IF BARCODE<>'A' then SELECT 1 FROM sam_user ...

  7. xls and xlsx

      xls XLS Namely  Microsoft Excel  Worksheet , It's a very common spreadsheet format .xls The file can be used Microsoft Excel open , In addition, Microsoft for those not installed Excel We have developed a special ...

  8. About EJB Time notes and oracle Database time format

    EJB in Temporal It's a time note , among TemporalType Is an enumeration type of time annotation, including TemporalType type , See the source code /*** Type used to indicate a speci ...

  9. MySQL Character set problem

    MySQL Many character sets and their encoding schemes are supported , Even the conversion between different codes . In the use of MySQL When programming applications , Garbled code often appears , This is usually due to the fact that the client does not declare a connection with MySQL String encoding for server communication ...

  10. vue Environmental reporting error chromedriver@2.44.1 install: `node install.js`

    terms of settlement : 1. yarn add chromedriver -g 2.yarn add chromedriver --chromedriver_cdnurl=http://cdn.npm.taoba ...