## CGAL::random_collinear_points_2

### Definition

#include <CGAL/point_generators_2.h>

template <class RandomAccessIterator, class OutputIterator>

OutputIterator

random_collinear_points_2 (
| RandomAccessIterator first, RandomAccessIterator last, std::size_t n, OutputIterator first2, Random& rnd = default_random, Creator creator = Creator_uniform_2<Kernel_traits<P>::Kernel::RT,P>)

|  | randomly chooses two points from the range [first,last), creates a random third point on the segment connecting these two points, writes it to first2, and repeats this n times, thus writing n points to first2 that are collinear with points in the range [first,last). Three random numbers are needed from rnd for each point. Returns the value of first2 after inserting the n points.

### Requirements

- Creator must be a function object accepting two double values x and y and returning an initialized point (x,y) of type P. Predefined implementations for these creators like the default can be found in Section .
- The value_type of the RandomAccessIterator must be assignable to P. P is equal to the value_type of the RandomAccessIterator when using the default initializer.
- The expressions to_double((*first).x()) and to_double((*first).y()) must result in the respective coordinate values.

### See Also

CGAL::perturb_points_2
CGAL::points_on_segment_2
CGAL::points_on_square_grid_2
CGAL::random_selection
std::random_shuffle