0
How to avoid duplicate numbers in this random generator?
var soma = 0
while (soma < 1000) {
soma += parseInt(Math.random() * 100)
document.write(soma + "<br>")
}
As it goes running, it arrives at a certain moment that it brings with it incidences of values.
You have to resize the values that have already been "drawn" somewhere. How many single numbers do you want? between 0 and 1000?
– Sergio
@Sergio Então Sergio, would leave only a single number between 0 and 1000. For example: 0 1 2 4 7 9 ... and avoid duplication of values 0 1 1 2 4 7 9 9 ...
– Diego Henrique