Pick random is not random - workaround?


The pick random block, when uploaded, produces the same series of numbers over and over, due to the Arduino pseudo-random. In the Arduino IDE i can use randomSeed(). Is there any workaround for mBlock?

Mblock5 random is not random

Hello, maybe a late answer but anyway. The workaround is define your own function by editing the extension. Take e.g. the file \mBlock345\ext\libraries\arduino\Arduino.s2e and add following section (just before the the “menus” section:
[“R”, “random %n”,“realRandom”,“100”, {“encode”:"{d0}",“setup”:“randomSeed(analogRead(0));\n”,“inc”:"",“def”:"",“work”:“random(1,({0})+1);\n”,“loop”:""}],
Save, then go to Extensions>Restore extensions and you can use the seeded random in your Arduino code.


How can we do the same in mblock5 ?
Where is random block C code in mblock5 ?