4 ms·
When I was little (and had too much free time) I memorized many digits of some transcendental numbers. The only (semi)practical use I've found for that knowledg
by zzrg 10y ago
When I was little (and had too much free time) I memorized many digits of some transcendental numbers. The only (semi)practical use I've found for that knowledge, is that I can use it as a reasonably good pseudorandom stream. If for some reason I have to choose things pseudorandomly. Pick an arbitrary starting point in pi, and press 'd' for even digits and 'f' for odd digits, I get around 0.49 accuracy with this oracle.
- grondilu 10y agoWell, that only shows that this oracle can be improved. It should be able to recognize that pattern from a well known transcendental number.
- jobigoud 10y agoThat might be a slippery slope though. Is a known random sequence less random than an original one? Should a randomness detector keep a database of all random sequence ever produced to give lower scores to known ones?
- snikeris 10y agoHaha, I did the same thing! From memory: 3.141592653589793238462643383279502884197969399375105 Now, the interesting question, how accurate is my recollection after all these years? Ack, one digit off!
- 3pt14159 10y agoI imagined how I would have coded it and so I devised a system to get it down as low as possible. I ended up with 0.44 accuracy. Pure random would have been better :)
- perennate 10y agoMm I did something similar, doesn't need memorization though: arbitrarily form sentences, go through the letters in order, and pick 'd' for a-m and 'f' for n-z. Of course there will be some patterns, but it's sufficient for this. And I think this strategy uses more free will :P
- thaumasiotes 10y agoYou don't need a transcendental number; simple counting has perfect entropy: 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111 10000... (Granted, that is a transcendental number -- the Champernowne constant for base 2 -- but there's no real need to think of it that way.)
- steego 10y agoI wrote a program that counts but only appends the sequence if the binary sequence isn't already there.
- thaumasiotes 10y ago> but only appends the sequence if the binary sequence isn't already there Why?
- Bognar 10y agoThis sequence seems to settle right around 50%: var simulateKeyPress = function(character) { var evt = document.createEvent("KeyboardEvent"); evt.initKeyEvent ("keypress", true, true, window, 0, 0, 0, 0, 0, character.charCodeAt(0)) document.body.dispatchEvent(evt); }; var num = 0; var loop = function() { console.log(num); var binary = num.toString(2); num++; for(var i = 0, len = binary.length; i < len; i++) { simulateKeyPress(binary[i] == '0' ? 'd' : 'f'); } }; setInterval(loop, 100);
- thaumasiotes 10y agoIt might sound weird, but I actually found that more readable as three lines of code. :/
- talaketu 10y agobut what if the challenge was not 2 chars but 3 (d, e, f)? pi (base 9) = 3.12418812407442788645177761731035828516545353462652301126321450283864034354163303086781327...