JSFiddle - React, Tailwind, and code Playground

by ha ha

HTML

<button id="btn" onclick="randomGo(45, 1)">button</button>
    <div id="randomNumber"></div>

CSS

button{
  width: 100px;
  height: 50px;
  background: #336699;
  font-size: 14px;
  border-radius: 5px;
  margin-bottom: 30px;
  border: 0;
  color: #fff;
  }

JavaScript

function randomGo(max, min){
   let randomNum = '';
   let numArray = [];
   let numIndex = 0;

  for(var i = 0; i <= 6; i++) {
  	randomNum = Math.floor(Math.random()*(max-min+1))+min; 
    for(var j = 0; j <=numArray.length; j++){
    	if(numArray[j] === randomNum){
      	//i= 0;
        break;
     	}
    }
    numArray.push(randomNum)
    console.log(i,numArray, randomNum)
	}

   document.getElementById('randomNumber').innerText = numArray;
 }