Struct random_intersperse_fn

Struct Documentation

struct random_intersperse_fn

Implementation detail for a random_intersperse range adaptor object.

Public Functions

template<class Range, class Fn, class URNG = typename ranges::detail::default_random_engine>
inline constexpr auto operator()(Range &&range, Fn fn, double probability = kDefaultProbability, URNG &engine = ranges::detail::get_random_engine()) const

Overload that implements the andom_intersperse algorithm.

Template Parameters:
  • Range – A forward range.

  • Fn – A callable type which takes no arguments or a distribution type that takes a URNG.

  • URNG – A random number generator that satisfies the UniformRandomBitGenerator requirements.

Parameters:
  • range – The range to be adapted.

  • fn – Fn instance used to insert values between source elements.

  • probability – The probability of inserting a value on each iteration.

  • engine – The random number generator object.

template<class Range, class Fn, class URNG>
inline constexpr auto operator()(Range &&range, Fn fn, double probability, std::reference_wrapper<URNG> engine) const

Overload that unwraps the engine reference from a view closure.

template<class Fn, class URNG = typename ranges::detail::default_random_engine>
inline constexpr auto operator()(Fn fn, double probability = kDefaultProbability, URNG &engine = ranges::detail::get_random_engine()) const

Overload that returns a view closure to compose with other views.

Template Parameters:
  • Fn – A callable type which takes no arguments and returns values to be inserted.

  • URNG – A random number generator that satisfies the UniformRandomBitGenerator requirements.

Parameters:
  • fn – Fn instance used to insert values between source elements.

  • probability – The probability of inserting a value on each iteration.

  • engine – The random number generator object.

Public Static Attributes

static constexpr double kDefaultProbability = 0.5

Default insertion probability on each iteration.