#include <iostream>
#include <iomanip>//able to use setw
#include <random>//contains random number generate feature in c++11
#include <ctime>
using namespace std;
int main(){
default_random_engine engine{(static_cast <unsigned int> (time (0)))};// time(0) is same with time(NULL)
//static cast makes the variable to keep the same data type through whole program.
//engine class generates random number.
uniform_int_distribution <unsigned int>randomInt{1 , 6};
//uniform_int_distribution makes set of random number's distribution between.
char wait;
for (unsigned int count = 1; count <= 10; count++){
cout << setw(10) << randomInt(engine);
if(count != 0 && count %5 == 0){
cout << endl;
}
}
cin >> wait;
return 0;
}
#include <iomanip>//able to use setw
#include <random>//contains random number generate feature in c++11
#include <ctime>
using namespace std;
int main(){
default_random_engine engine{(static_cast <unsigned int> (time (0)))};// time(0) is same with time(NULL)
//static cast makes the variable to keep the same data type through whole program.
//engine class generates random number.
uniform_int_distribution <unsigned int>randomInt{1 , 6};
//uniform_int_distribution makes set of random number's distribution between.
char wait;
for (unsigned int count = 1; count <= 10; count++){
cout << setw(10) << randomInt(engine);
if(count != 0 && count %5 == 0){
cout << endl;
}
}
cin >> wait;
return 0;
}
댓글
댓글 쓰기