Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <random>
- #include <vector>
- template <typename Generator>
- double randomDoubleEngine(Generator& engine, double low_bound, double high_bound )
- {
- if (low_bound > high_bound){
- std::swap(low_bound, high_bound);
- }
- return std::uniform_real_distribution<>( low_bound, high_bound )( engine );
- }
- void doSomething(){
- std::mt19937 engine;
- double low = -1.7411500;
- double high = 2.2737999;
- for(int i =0; i < 20; i++){
- std::cout << randomDoubleEngine(engine, low, high ) << std::endl;
- }
- }
- int main(){
- for(int i = 0; i < 5; i++){
- std::cout << "####################################\n";
- std::cout << "# Call number: " << i << "\n";
- doSomething();
- std::cout << "####################################\n\n";
- }
- return (EXIT_SUCCESS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement