JSFiddle - React, Tailwind, and code Playground

HTML

<html>

  <body>
    <span id="lenTxt">Length: </span>
    <input type="text" id="lenVal">
    <button id="generateNameBtn">Generate</button>
    <div id="generatedName">

    </div>
  </body>

</html>

JavaScript

function getName(l) {
if(l < 1){
	return "Нахуй иди";
}
  return Array.from({
    length: l
  }, () => Math.ceil(Math.random() * (112 - 97) + 97)).map(i => String.fromCharCode(i)).join("");
}
document.getElementById("generateNameBtn").addEventListener("click",
  function() {
    document.getElementById("generatedName").innerHTML =
      getName(document.getElementById("lenVal").value);
  });