Verify distribution uniformity/Naive: Difference between revisions

Content added Content deleted
m (Added missing function)
(Updated D entry)
Line 334: Line 334:
if (isCallable!TF) {
if (isCallable!TF) {
int[int] counts;
int[int] counts;
foreach (i; 0 .. nRepeats)
foreach (immutable i; 0 .. nRepeats)
counts[func()]++;
counts[func()]++;
immutable double target = nRepeats / cast(double)counts.length;
immutable double target = nRepeats / double(counts.length);
immutable int deltaCount = cast(int)(delta / 100.0 * target);
immutable int deltaCount = cast(int)(delta / 100.0 * target);


Line 347: Line 347:
foreach (k; counts.keys.sort())
foreach (k; counts.keys.sort())
writeln(k, " ", counts[k]);
writeln(k, " ", counts[k]);
writeln();
writeln;
}
}