Created
December 1, 2017 11:03
-
-
Save io-developer/f548563f7fadfd0acbc9a4dfd7b69634 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function calcAt(row, col, generator) { | |
var val; | |
for (var i = 0, l = 2 * Math.max(row, col); i <= l; i++) { | |
for (var j = 0; j <= i; j++) { | |
val = generator(val); | |
if (row == i - j && col == j) { | |
return val; | |
} | |
} | |
} | |
return undefined; | |
} | |
function generator(prev) { | |
if (prev === undefined) { | |
return 20151125; | |
} | |
return (prev * 252533) % 33554393; | |
} | |
console.log(calcAt(3010 - 1, 3019 - 1, generator)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment