Created
September 20, 2012 05:12
-
-
Save aoisensi/3754078 to your computer and use it in GitHub Desktop.
ujm test 2012/09/20
This file contains hidden or 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 <random> | |
#include <iostream> | |
#include <time.h> | |
using namespace std; | |
void randomize() | |
{ | |
srand((unsigned int)clock()); | |
} | |
int rnd(int o) | |
{ | |
return (int)(rand()*o/(RAND_MAX+1.0)); | |
} | |
int* rndarray(int size, int o) | |
{ | |
int* result = new int[size]; | |
for(int i=0;i<size;++i) | |
{ | |
result[i] = rnd(o); | |
} | |
return result; | |
} | |
int main() | |
{ | |
randomize(); | |
int size = 0; | |
int o = 0; | |
while(cin >> size >> o) | |
{ | |
int* r = rndarray(size, o); | |
for(int i=0;i<size;++i) | |
{ | |
cout << r[i] << endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment