Generador de código aleatorio simple

<html>  
<head>   
<title> Random String Generator </title>  
</head>  
  
<script>  
function randomStringGenerator() {  
    var characters = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";  
              
            //specify the length random new string  
    var lenString = 8;  
    var randomstring = '';  
  
    for (var i=0; i<lenString; i++) {  
        var rnum = Math.floor(Math.random() * characters.length);  
        randomstring += characters.substring(rnum, rnum+1);  
    }  
  
    document.getElementById("randomfield").innerHTML = randomstring;  
}  
</script>  
  
<body>  
<center>  
<h2 style="color: red"> Random String Generator </h2>  
<h3> Click the button to generate a new random string </h3>  
  
<form name="randomstring">  
<input type="button" value="Generate " onClick="randomStringGenerator();">  
<br><br>  
<b><p id="randomfield" style="color: blueviolet"> </p></b>  
</form>  
  
</center>  
</body>  
</html>
Outrageous Ostrich