52 std::vector<size_t> result;
56 throw std::invalid_argument(
57 "Cannot select more unique elements than there are elements: k == " +
63 std::uniform_real_distribution<double> distribution( 0.0, 1.0 );
70 double const u = distribution( engine );
72 if( (n - t) * u >= k - m ) {
76 result.push_back( t );
82 assert( result.size() == k );
Container namespace for all symbols of genesis in order to keep them separate when used as a library...
std::default_random_engine & random_engine()
Returns the default engine for random number generation.
std::vector< size_t > select_without_replacement(size_t const k, size_t const n)
Select k many unique numbers out of the range [ 0, n ).
std::shared_ptr< BaseOutputTarget > to_string(std::string &target_string)
Obtain an output target for writing to a string.
static Options & get()
Returns a single instance of this class.