#include <iostream>
#include "bm.h"
#include "bmrandom.h"
#include "bmundef.h"
using namespace std;
template<class T> void PrintContainer(T first, T last)
{
if (first == last)
cout << "<EMPTY SET>";
else
for(;first != last; ++first)
cout << *first << ";";
cout << endl;
}
int main(void)
{
try
{
bm::bvector<> bv;
bm::bvector<>::size_type i;
for (i = 0; i < 30000; i+=10)
{
bv.set(i);
}
for (i = 300000; i < 400000; i+=100)
{
bv.set(i);
}
bm::bvector<> bvsubset1;
bm::bvector<> bvsubset2;
bm::random_subset<bm::bvector<> > rand_sampler;
rand_sampler.sample(bvsubset1, bv, 20);
rand_sampler.sample(bvsubset2, bv, 20);
PrintContainer(bvsubset1.first(), bvsubset1.end());
cout << endl;
PrintContainer(bvsubset2.first(), bvsubset2.end());
}
catch(std::exception& ex)
{
std::cerr << ex.what() << std::endl;
return 1;
}
return 0;
}