Skip to content

Instantly share code, notes, and snippets.

@Devhobby
Created May 22, 2018 19:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Devhobby/68f227144a61f455313620d72cda1de6 to your computer and use it in GitHub Desktop.
std::default_random_engine generator
#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