How to return a random number in javascript which is always greater then the previous number -


how can return random number in javascript greater previous random number every time code reruns. example when code runs first time returns 1000 , when runs second time returns 1300.

conditions: number must integer.

function randomfunction() {   var x = 0   return function() {     x = x + math.round( math.random() * 100 )     return x   } }  var nextrandom = randomfunction()  nextrandom() // => 51 nextrandom() // => 127 nextrandom() // => 203 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -