1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // <algorithm>
11
12 // template <class PopulationIterator, class SampleIterator, class Distance,
13 // class UniformRandomNumberGenerator>
14 // SampleIterator sample(PopulationIterator first, PopulationIterator last,
15 // SampleIterator out, Distance n,
16 // UniformRandomNumberGenerator &&g);
17
18 #include <experimental/algorithm>
19 #include <random>
20 #include <cassert>
21
22 #include "test_iterators.h"
23
test()24 template <class PopulationIterator, class SampleIterator> void test() {
25 int ia[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
26 const unsigned is = sizeof(ia) / sizeof(ia[0]);
27 const unsigned os = 4;
28 int oa[os];
29 std::minstd_rand g;
30 std::experimental::sample(PopulationIterator(ia), PopulationIterator(ia + is),
31 SampleIterator(oa), os, g);
32 }
33
main()34 int main() {
35 test<input_iterator<int *>, output_iterator<int *> >();
36 }
37