Last active
September 24, 2018 16:07
-
-
Save brito/65867747bdc3a0ce9acf7cbbba98d564 to your computer and use it in GitHub Desktop.
number generator from continuous fraction of timestamp
This file contains hidden or 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
//codegolf.stackexchange.com/a/79490/69502 | |
continuous_fraction = f = (n,d) => n%d ? [r=(n/d)|0,...f(d,n-r*d)] : [n/d] | |
bars = n => console.debug(n, Array(n).fill('|').join('')) | |
interval = | |
setInterval(() => { | |
requestAnimationFrame(() => { | |
now = new Date | |
a = ~now | |
b = ~~now | |
indices = continuous_fraction(+now, b) | |
console.log(+now, b, a, b+a, indices) | |
indices.slice(1).forEach(bars) | |
}) | |
}, 1e3) | |
max = 5 | |
cheapo_limiter = | |
setInterval(() => !--max ? | |
[interval, cheapo_limiter] | |
.map(clearInterval) : 0, 1e3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment