dimanche 29 juillet 2018

Javascript random text generate randomly

I want create javascript random script which makes random text which every text has assigned random integer to it. and everything will be separated by , i.e es45d4dw 2, Every item should be generated at random different time from range. How can i do that?

var myVar = setInterval(myFunction, getRndInteger(1000, 10000));

    function getRndInteger(min, max) {
        return Math.floor(Math.random() * (max - min + 1) ) + min;
    }

    function myFunction() {
        var para = document.createElement("t");
        var t = document.createTextNode(makeid());
        para.appendChild(t);
        document.body.appendChild(para);
    }

    function makeid() {
      var text = "";
      var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

      for (var i = 0; i < 10; i++)
        text += possible.charAt(Math.floor(Math.random() * possible.length));

      return text;
    }




Aucun commentaire:

Enregistrer un commentaire