MCPcopy Create free account
hub / github.com/cuberite/cuberite / TestInts

Method TestInts

src/FastRandom.cpp:28–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26
27
28 void TestInts(void)
29 {
30 printf("Testing ints...\n");
31 cFastRandom rnd;
32 int sum = 0;
33 const int BUCKETS = 8;
34 int Counts[BUCKETS];
35 memset(Counts, 0, sizeof(Counts));
36 const int ITER = 10000;
37 for (int i = 0; i < ITER; i++)
38 {
39 int v = rnd.NextInt(1000);
40 ASSERT(v >= 0);
41 ASSERT(v < 1000);
42 Counts[v % BUCKETS]++;
43 sum += v;
44 }
45 double avg = (double)sum / ITER;
46 printf("avg: %f\n", avg);
47 for (int i = 0; i < BUCKETS; i++)
48 {
49 printf(" bucket %d: %d\n", i, Counts[i]);
50 }
51 }
52
53
54 void TestFloats(void)

Callers

nothing calls this directly

Calls 1

NextIntMethod · 0.80

Tested by

no test coverage detected