yo/stl/examples/normal.cc
raw| 1 | #include <iostream> |
| 2 | #include <ctime> |
| 3 | #include <random> |
| 4 | using namespace std; |
| 5 | |
| 6 | int main() |
| 7 | { |
| 8 | std::mt19937 engine(time(0)); |
| 9 | std::normal_distribution<> dist; |
| 10 | |
| 11 | for (size_t idx = 0; idx < 10; ++idx) |
| 12 | std::cout << "a random value: " << dist(engine) << "\n"; |
| 13 | |
| 14 | cout << '\n' << |
| 15 | dist.min() << " " << dist.max() << '\n'; |
| 16 | } |