Open microbit-carlos opened 4 months ago
From:
Replicable example from:
#include "MicroBit.h" MicroBit uBit; int main() { uBit.init(); microbit_seed_random(); int seed = microbit_random(0x7fffffff); DMESG("random seed: %d", seed); uBit.seedRandom(seed); int randomInt = uBit.random(9); uBit.display.print(randomInt); }
{ "target": { "name": "codal-microbit-v2", "url": "https://github.com/lancaster-university/codal-microbit-v2", "branch": "master", "type": "git" }, "config":{ "MICROBIT_BLE_ENABLED" : 1 } }
With this example the random numbers are always seeded with the same value. Changing MICROBIT_BLE_ENABLED to 1 works.
MICROBIT_BLE_ENABLED
1
Possible solution:
From:
Replicable example from:
With this example the random numbers are always seeded with the same value. Changing
MICROBIT_BLE_ENABLED
to1
works.Possible solution: