Hi and thanks again for detailed response,
First 10 was due to the information from
Documentation/Conformance Test Outline.txt
II.8 Shared Reply Timing
The test tool issues a query for a shared (service PTR) record, and records how quickly the device answers. This test is repeated 10 times.
So the assumption of this is understood and I agree to "always" have skewed binning.
Attached below is a small test I threw together by pulling the response delay code out of mDNSResponder and then hard coding values
Thank you for providing the code. I modify a bit to be able to build in our DUT
// main.m
// bonjour_ranTest
//
// Created by Kevin Elliott on 3/16/26.
//
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <stdint.h> // Added
uint32_t mDNSPlatformRandomNumber(void)
{
return(arc4random());
}
uint32_t mDNSRandom(uint32_t max) // Returns pseudo-random result from zero to max inclusive
{
#if 1
uint32_t ret = 0;
uint32_t mask = 1;
while (mask < max) mask = (mask << 1) | 1;
do ret = mDNSPlatformRandomNumber() & mask;
while (ret > max);
return ret;
#else
return arc4random_uniform(max+1);
#endif
}
int main(int argc, const char * argv[]) {
// Removed autoreleasepool
const int count = 100000; // Modified to other sample size
uint32_t mDNSPlatformOneSecond = 1024;
uint32_t delayresponse = mDNSPlatformOneSecond;
uint32_t ranArray[count + 10];
uint32_t count20_45 = 0;
uint32_t count46_71 = 0;
uint32_t count72_97 = 0;
uint32_t count98_125 = 0;
uint32_t minVal = 1000;
uint32_t maxVal = 0;
for (int i = 0; i<count; i++) { // Modified
uint32_t ranVal = (uint32_t)mDNSRandom((uint32_t)mDNSPlatformOneSecond * 5) + 49;
uint32_t val = ((delayresponse + ranVal) / 50);
ranArray[i] = val;
//printf("Num: %d\n", ranArray[i]);
if(val < minVal) minVal = val;
if(val > maxVal) maxVal = val;
if(val >=20 && val<=45){
count20_45++;
}
else if(val >=45 && val<=71){
count46_71++;
}
else if(val >=72 && val<=97){
count72_97++;
}
else if(val >=98 && val<=125){
count98_125++;
}
else {
printf("BIN FAIL!!! %d\n", val);
assert(0);
}
printf("max: %d min: %d\n", maxVal, minVal);
float perc = count20_45 * 1.0;
perc = (perc/count) * 100.0;
printf("count20_45: %d, %f\n", count20_45, perc); // Modified
perc = count46_71 * 1.0;
perc = (perc/count) * 100.0;
printf("count46_71: %d, %f\n", count46_71, perc);
perc = count72_97 * 1.0;
perc = (perc/count) * 100.0;
printf("count72_97: %d, %f\n", count72_97, perc); // Modified
perc = count98_125 * 1.0;
perc = (perc/count) * 100.0;
printf("count98_125: %d, %f\n", count98_125, perc); // Modified
}
return EXIT_SUCCESS;
}
Below is the result after running:
COUNT: 100000
max: 123 min: 21
count20_45: 23933, 23.932999
count46_71: 25400, 25.400002
count72_97: 25303, 25.302999
count98_125: 25364, 25.364000
Result: There is uniform distribution of actual values per 26ms quadrant
Also tested other COUNT. For COUNT 10 in particular, there is tendency to exceed acceptable threshold of 26ms quadrant. As COUNT becomes larger, the distribution becomes uniform
COUNT: 10
max: 112 min: 30
count20_45: 2, 20.000000
count46_71: 1, 10.000000
count72_97: 5, 50.000000 ✦ Again, this also exceeded range
count98_125: 2, 20.000000
COUNT: 100
max: 123 min: 22
count20_45: 23, 23.000000
count46_71: 23, 23.000000
count72_97: 28, 28.000000
count98_125: 27, 27.000002
COUNT: 1000
max: 123 min: 21
count20_45: 238, 23.800001
count46_71: 280, 28.000000
count72_97: 256, 25.600000
count98_125: 227, 22.700001
For the arc4random_uniform(), modified mDNSResponder for a possible solution, but seems to still occur.
As sample size becomes larger, distribution becomes uniform. So assumption is that the issue occurs due to small sample size in BCT Shared Reply Timing test. Therefore, for BCT, is it possible to increase the test from 10 to 100.
Or in the current version BCT 1.5.4 (15400), I would like to confirm if the result of SHARED REPLY TIMING with Warning is not an issue and can still result to BCT certification to Pass.
Thank you.