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

Function getRandom6

libraries/randomHelpers/randomHelpers.cpp:109–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107
108
109uint8_t getRandom6()
110{
111 if (__randomIdx < 6)
112 {
113 __randomBuffer = getRandom32();
114 __randomIdx = 32;
115 }
116 uint8_t rv = __randomBuffer & 0x3F;
117 __randomBuffer >>= 6;
118 __randomIdx -= 6;
119 return rv;
120}
121
122
123// typical use

Callers 1

unittestFunction · 0.85

Calls 1

getRandom32Function · 0.85

Tested by 1

unittestFunction · 0.68