3 ms·
I modified the "randomize!" button to inject the de Bruijn sequence DB(2,6), and I get a rate of 50%. Is there an error in my patch ? diff --git a/not-so-ra
by sebhtml 8y ago
I modified the "randomize!" button to inject the de Bruijn sequence DB(2,6), and I get a rate of 50%.
Is there an error in my patch ?
diff --git a/not-so-random.html b/not-so-random.html
index 48c04da..c650b5b 100644
--- a/not-so-random.html
+++ b/not-so-random.html
@@ -169,8 +169,12 @@
randomHelpFunc = function(evt) {
evt.preventDefault();
//document.onkeydown = null;
- for (let i = 0; i<10; i++) {
- lastKey = Math.round(Math.random());
+
+ // db(2, 6)
+ var inputString = "0000001000011000101000111001001011001101001111010101110110111111";
+
+ for (let i = 0; i< inputString.length; i++) {
+ lastKey = inputString[i] == "0" ? 0 : 1;
testPrediction();
updateAll();
predictNext()
- btilly 8y agoI didn't review the patch, but that is the expected result. That sequence will cause it to think that whatever previous 5 pattern it saw, your next is equally likely to be 1 or 0. So it will guess randomly, and half the time it is right. However with $1 vs $1.05 returns, you'll steadily make money.