Guest User

Untitled

a guest
Jan 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. var letra = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
  2. var letra_o_numero,
  3. numero=0,
  4. string="";
  5. function id() {
  6.  
  7. for(i=0;i<=5;i++){
  8. letra_o_numero = Math.floor(Math.random(5)*2);
  9. //si es 1, que el string sea una letra
  10. if (letra_o_numero == 1){
  11. string += letra[Math.floor(Math.random(5)*26)];
  12.  
  13. }else{
  14. // si es 2, que escriba un numero
  15. numero = Math.floor(Math.random(5)*10);
  16. string += numero;
  17. }
  18. }
  19. // el String quedara de largo 15
  20. return string;
  21. }
Add Comment
Please, Sign In to add comment