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

Function RandomCharArray

engine/dlib/src/test/test_lz4.cpp:72–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72char * RandomCharArray(int max, int *real)
73{
74 char *tmp;
75 uint32_t n = rand() % max;
76 if (n == 0)
77 n++;
78
79 tmp = (char *)malloc(n + 1);
80
81 for (uint32_t j = 0; j < n; ++j)
82 {
83 char c = 'a' + (rand() % 26);
84 tmp[j] = c;
85 }
86 tmp[n] = 0;
87
88 *real = n;
89
90 return tmp;
91}
92
93TEST(dmLZ4, Stress)
94{

Callers 1

TESTFunction · 0.85

Calls 2

randClass · 0.85
mallocFunction · 0.85

Tested by

no test coverage detected