Javascript to Generate a Random String




javascript to generate random string

function randomString(sChrs,iLen) {
    var sRnd = '';
    for (var i=0; i<iLen; i++){
        var randomPoz = Math.floor(Math.random() * sChrs.length);
        sRnd += sChrs.substring(randomPoz,randomPoz+1);
    }
    return sRnd;
}

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>