Skip to content

Commit

Permalink
Removing the Sampler interface allows the asserts to be effective.
Browse files Browse the repository at this point in the history
  • Loading branch information
WebDrake committed Apr 13, 2012
1 parent daaedbf commit 9010213
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions sampled.d
Expand Up @@ -3,12 +3,8 @@ import std.random;
import std.stdio;
import std.c.time;

interface Sampler(UniformRNG) {
size_t select(ref UniformRNG urng);
}


class Skipper(UniformRNG): Sampler!UniformRNG {
class Skipper(UniformRNG) {
this(size_t records, size_t sample, ref UniformRNG urng)
{
_recordsRemaining = _recordsTotal = records;
Expand Down Expand Up @@ -172,17 +168,6 @@ void sampling_test_simple(SamplerType, UniformRNG)
write("\trecords remaining: ", s.recordsRemaining, ".");
writeln("\tstill to sample: ", s.sampleRemaining, ".");
}
// Let's see if we can bust this ...

writeln("Selecting 1 more just for luck: ", s.select(urng), ", records remaining: ", s.recordsRemaining, ", still to sample: ", s.sampleRemaining);
writeln("Selecting 1 more just for luck: ", s.select(urng), ", records remaining: ", s.recordsRemaining, ", still to sample: ", s.sampleRemaining);
writeln("Selecting 1 more just for luck: ", s.select(urng), ", records remaining: ", s.recordsRemaining, ", still to sample: ", s.sampleRemaining);
writeln("Selecting 1 more just for luck: ", s.select(urng), ", records remaining: ", s.recordsRemaining, ", still to sample: ", s.sampleRemaining);
writeln("Selecting 1 more just for luck: ", s.select(urng), ", records remaining: ", s.recordsRemaining, ", still to sample: ", s.sampleRemaining);
writeln("Selecting 1 more just for luck: ", s.select(urng), ", records remaining: ", s.recordsRemaining, ", still to sample: ", s.sampleRemaining);
writeln("Selecting 1 more just for luck: ", s.select(urng), ", records remaining: ", s.recordsRemaining, ", still to sample: ", s.sampleRemaining);
writeln("Selecting 1 more just for luck: ", s.select(urng), ", records remaining: ", s.recordsRemaining, ", still to sample: ", s.sampleRemaining);
writeln("Selecting 1 more just for luck: ", s.select(urng), ", records remaining: ", s.recordsRemaining, ", still to sample: ", s.sampleRemaining);
}

void sampling_test_aggregate(SamplerType, UniformRNG)
Expand Down

0 comments on commit 9010213

Please sign in to comment.