Skip to content

Instantly share code, notes, and snippets.

@hokein
Created December 27, 2013 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hokein/8144021 to your computer and use it in GitHub Desktop.
Save hokein/8144021 to your computer and use it in GitHub Desktop.
A random number generator.
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
const int MOD = 10;
int main() {
freopen("test.txt", "w", stdout);
srand((int)time(0));
int T = 1000;
cout << T << endl;
for (int i = 0; i < T; ++i) {
int n = rand()%MOD + 5;
cout << n << endl;
for (int j = 0; j < n; ++j)
cout << rand()%MOD - 5 << " ";
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment