Created
May 22, 2018 19:10
Star
You must be signed in to star a gist
std::default_random_engine generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <random> | |
int main(){ | |
std::default_random_engine generator; | |
//wyświetla 20 liczb losowych z zakresu 0 do 9 | |
std::uniform_int_distribution<int> distribution(0, 9); | |
for (int i = 0; i<20; ++i) { | |
int number = distribution(generator); | |
std::cout << number << std::endl; | |
} | |
//wyświetla 20 liczb losowych z zakresu 20 do 50 | |
std::uniform_int_distribution<int> distribution_(20, 50); | |
for (int i = 0; i<20; ++i) { | |
int number = distribution_(generator); | |
std::cout << number << std::endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment