I want to know why my Random number generator generates same number, i even did a while loop to stop the same generating numbers from generating, and once the 25 numbers are done generating it will restart again.
here is my html
Math.random() actually returns a pseudo-random number rather than a truly random number. It’s a bit tough to explain, but essentially if you want a truly random number you’ll need to use some other methods. I’d recommend searching online for how to make a truly random number in JavaScript, or how to change the seed every time.
You have a couple of (small) issues here - if you open the browser console, you can see the errors.
textarea.value = list --> that line throws an error, because textarea is not defined. First, you’ve called the variable textArea (camelCase), second, you’ve defined it inside the function, and then try to access it from outside the function.
let nbr = newrandomNumber(25) --> throws an error because first, again, you’ve defined the variable as newRandomNumber (camelCase), and second, it’s only a variable, not a function, so you can’t call it with brackets like newRandomNumber(25).
I’m not sure what’s the goal of your code, but if you fix these issues, you’ll get a new random number in your text area with each button click.