JSFiddle - React, Tailwind, and code Playground

HTML

Mostra de 1000 numeros unicos
<div id="resultados"></div>
<button id="sortearNovo">Escolher novo:</button>
<div id="novoNumero"></div>

CSS

div {
    margin-bottom:20px;
    padding-top:20px;
}
#resultados {
    height:100px;
    overflow-y:scroll;
    border:1px solid black;
}

JavaScript

var sorteados = [];
var valorMaximo = 1000;

function criarUnico() {
    if (sorteados.length == valorMaximo) {
        if (confirm('Já não há mais! Quer recomeçar?')) sorteados = [];
        else return;
    }
    var sugestao = Math.ceil(Math.random() * valorMaximo);
    while (sorteados.indexOf(sugestao) >= 0) {
        sugestao = Math.ceil(Math.random() * valorMaximo);
    }
    sorteados.push(sugestao);
    return sugestao;
}
document.getElementById('resultados').innerHTML = '';
for (var i = 0; i < valorMaximo; i++) {
    document.getElementById('resultados').innerHTML += criarUnico() + ', ';
}
sorteados = [];
var sortearNovo = document.getElementById('sortearNovo');
var novoNumero = document.getElementById('novoNumero');
sortearNovo.addEventListener('click', function () {
    novoNumero.innerHTML = criarUnico();
});