Range algorithms, views, and actions for the Standard Library
ranges::view::sample_fn Struct Reference


Returns a random sample of a range of length size(range).

Synopsis of methods

constexpr view< sample_fnsample {}

Public Member Functions

template<typename Rng , typename URNG = detail::default_random_engine>
auto operator() (Rng &&rng, range_difference_t< Rng > sample_size, URNG &generator=detail::get_random_engine()) const -> sample_view< all_t< Rng >, URNG > requires ViewableRange< Rng > &&InputRange< Rng > &&UniformRandomNumberGenerator< URNG > &&ConvertibleTo< invoke_result_t< URNG & >, range_difference_t< Rng >> &&(SizedRange< Rng >||SizedSentinel< sentinel_t< Rng >, iterator_t< Rng >>||ForwardRange< Rng >)