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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

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