MCPcopy Create free account
hub / github.com/Tracktion/choc / createRandomData

Function createRandomData

tests/choc_tests.h:3390–3411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3388}
3389
3390static std::string createRandomData (size_t length)
3391{
3392 std::ostringstream out (std::ios::binary);
3393 size_t total = 0;
3394
3395 while (total < length)
3396 {
3397 size_t reps = 1;
3398
3399 if ((rand() & 7) > 4)
3400 reps += (size_t) ((rand() & 7) < 5 ? (rand() & 7) : (rand() & 1023));
3401
3402 auto c = rand() & 255;
3403
3404 for (size_t i = 0; i < reps; ++i)
3405 out << (char) c;
3406
3407 total += reps;
3408 }
3409
3410 return out.str().substr (0, length);
3411}
3412
3413static void testZLIB (choc::test::TestProgress& progress)
3414{

Callers 1

testZLIBFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected