4
I need to draw 16 numbers and store them in an array, but there can be no repeat numbers. Follow the code.
var numero = [];
function numero_aleatorio () {
for(i=0;i<16;i++) {
numero.push(Math.floor((Math.random() * 16) + 1));
}
}
numero_aleatorio();
that question already has an answer. https://answall.com/questions/10282/n%C3%Bamero-aleat%C3%B3rio-sem-repeti%C3%A7%C3%A3o? Rq=1
– user60252
I tried using that function [https://answall.com/questions/10282/n%C3%Bamero-aleat%C3%B3rio-sem-repeti%C3%A7%C3%A3o? Rq=1], but it wasn’t working
– Diego Soares
Hello Diego, I voted to close because even the answer of Sérgio not being the one who seeks the following answer, of Bacco, answers exactly what you need https://pt.stackoverflowcom/a/10284/3635, it is always nice look hereafter of the answer accepted, other answers even if not accepted may solve the problem ;D
– Guilherme Nascimento