Code
let min = -100;
let max = 100;
var dataArr = [];
var newValue = 0;
for (let i = 0; i<151; i++) {
newValue += Math.floor(Math.random() * (max - min + 1)) + min;
dataArr.push(newValue);
};
I wonder how to make it so it gets restricted from getting a number under 0.
I need the range with -100, but some kind of system that prevents it to get -1 or less.
If it’s at 100 for example then -100 should work.
If that doesn’t work to make, then I need it to refresh the page or restart the for loop till it gets the correct data.