| 1 | // Copyright (C) 2020-2025 Free Software Foundation, Inc. |
| 2 | // |
| 3 | // This file is part of the GNU ISO C++ Library. This library is free |
| 4 | // software; you can redistribute it and/or modify it under the |
| 5 | // terms of the GNU General Public License as published by the |
| 6 | // Free Software Foundation; either version 3, or (at your option) |
| 7 | // any later version. |
| 8 | |
| 9 | // This library is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | // GNU General Public License for more details. |
| 13 | |
| 14 | // You should have received a copy of the GNU General Public License along |
| 15 | // with this library; see the file COPYING3. If not see |
| 16 | // <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | // { dg-do run { target c++11 } } |
| 19 | |
| 20 | #include <random> |
| 21 | #include <cstdint> |
| 22 | #include <testsuite_hooks.h> |
| 23 | |
| 24 | void |
| 25 | test01() |
| 26 | { |
| 27 | // PR libstdc++/97311 |
| 28 | |
| 29 | using i64 = std::int_least64_t; // can hold all values of uint32_t |
| 30 | std::vector<i64> v(10); |
| 31 | std::seed_seq s; |
| 32 | s.generate(v.begin(), v.end()); |
| 33 | |
| 34 | const std::vector<i64> expected{ |
| 35 | 0xbc199682, |
| 36 | 0x7a094407, |
| 37 | 0xac05bf42, |
| 38 | 0x10baa2f4, |
| 39 | 0x822d6fde, |
| 40 | 0xf08cdc22, |
| 41 | 0x30382aee, |
| 42 | 0xbd5fb4aa, |
| 43 | 0xb26c5a35, |
| 44 | 0xb9619724 |
| 45 | }; |
| 46 | VERIFY( v == expected ); |
| 47 | } |
| 48 | |
| 49 | int |
| 50 | main() |
| 51 | { |
| 52 | test01(); |
| 53 | } |