1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// <random>
10
11// template<class UIntType, size_t w, size_t s, size_t r>
12// class subtract_with_carry_engine;
13
14// template<class Sseq> void seed(Sseq& q);
15
16#include <random>
17#include <cassert>
18
19#include "test_macros.h"
20
21void
22test1()
23{
24 unsigned a[] = {3, 5, 7};
25 std::seed_seq sseq(a, a+3);
26 std::ranlux24_base e1;
27 std::ranlux24_base e2(sseq);
28 assert(e1 != e2);
29 e1.seed(sseq);
30 assert(e1 == e2);
31}
32
33void
34test2()
35{
36 unsigned a[] = {3, 5, 7};
37 std::seed_seq sseq(a, a+3);
38 std::ranlux48_base e1;
39 std::ranlux48_base e2(sseq);
40 assert(e1 != e2);
41 e1.seed(q&: sseq);
42 assert(e1 == e2);
43}
44
45int main(int, char**)
46{
47 test1();
48 test2();
49
50 return 0;
51}
52

source code of libcxx/test/std/numerics/rand/rand.eng/rand.eng.sub/seed_sseq.pass.cpp