MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / getRandom1

Function getRandom1

libraries/randomHelpers/randomHelpers.cpp:61–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59
60
61bool getRandom1()
62{
63 if (__randomIdx < 1)
64 {
65 __randomBuffer = getRandom32();
66 __randomIdx = 32;
67 }
68 bool rv = __randomBuffer & 0x01;
69 __randomBuffer >>= 1;
70 __randomIdx--;
71 return rv;
72}
73
74// typical use
75bool inline flipCoin()

Callers 2

flipCoinFunction · 0.85
unittestFunction · 0.85

Calls 1

getRandom32Function · 0.85

Tested by 1

unittestFunction · 0.68