I am creating fake statistics real-time data for that I need to show the number of users available on the website for one game of 5 minutes, I want to generate random numbers within a range of 1 to 100, but in incremental order. Which means every number that I get should be greater than the previous one.
Expected output: Output at each function call will be like 1,5,12,25,...,98,100 in randomized and incremental order only. Thanks in advance.
My code:
randomnumber(fixed,count,range){
return fixed+count*range;
},
function(){
var count = 1;
this.socketData( ({ data }) => {
count++
data.data.totalUsers += this.randomnumber(50,count,Math.abs(Math.floor(Math.random() * (100 - 1) +1)));
}