Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <random>
- int main() {
- using ElemT = float;
- // Predefined random number generators
- // https://en.cppreference.com/w/cpp/numeric/random
- std::mt19937_64 engine{ std::random_device{}() };
- // Random number distributions
- // https://en.cppreference.com/w/cpp/numeric/random
- std::normal_distribution<ElemT> normal{ 0.0f, 0.5f };
- std::exponential_distribution<ElemT> exp{ 1.0f };
- for (auto i : std::vector<ElemT>(10, 0.0f)) {
- std::cout << exp(engine) << std::endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement