brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1020 B · 6e99e8a Raw
52 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <random>10 11// template<class Engine, size_t p, size_t r>12// class discard_block_engine13 14// template<class Sseq> void seed(Sseq& q);15 16#include <random>17#include <cassert>18 19#include "test_macros.h"20 21void22test1()23{24    unsigned a[] = {3, 5, 7};25    std::seed_seq sseq(a, a+3);26    std::ranlux24 e1;27    std::ranlux24 e2(sseq);28    assert(e1 != e2);29    e1.seed(sseq);30    assert(e1 == e2);31}32 33void34test2()35{36    unsigned a[] = {3, 5, 7};37    std::seed_seq sseq(a, a+3);38    std::ranlux48 e1;39    std::ranlux48 e2(sseq);40    assert(e1 != e2);41    e1.seed(sseq);42    assert(e1 == e2);43}44 45int main(int, char**)46{47    test1();48    test2();49 50  return 0;51}52