dimanche 7 août 2016

Javascript generate random string /characters

I would like to change this code so it can generate only 16 unique numbers every time and also another one with 16 Upper case words and numbers, i tried to change but always have smaller or bigger number and always different length

function rand(length,current){
 current = current ? current : '';
 return length ? rand( --length , "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz".charAt( Math.floor( Math.random() * 60 ) ) + current ) : current;
}

alert(rand(5));




Aucun commentaire:

Enregistrer un commentaire