MCPcopy Create free account
hub / github.com/defold/defold / irand32

Function irand32

engine/dlib/src/basis/transcoder/basisu_containers_impl.h:165–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163 }
164
165 static int irand32(int l, int h)
166 {
167 assert(l < h);
168 if (l >= h)
169 return l;
170
171 uint32_t range = static_cast<uint32_t>(h - l);
172
173 uint32_t rnd = urand32();
174
175 uint32_t rnd_range = static_cast<uint32_t>((((uint64_t)range) * ((uint64_t)rnd)) >> 32U);
176
177 int result = l + rnd_range;
178 assert((result >= l) && (result < h));
179 return result;
180 }
181
182 void hash_map_test()
183 {

Callers 1

hash_map_testFunction · 0.85

Calls 2

urand32Function · 0.85
assertFunction · 0.50

Tested by

no test coverage detected