Random sequence generator
This commit is contained in:
parent
63f748b9da
commit
3aa98da0b4
1 changed files with 16 additions and 0 deletions
16
gen.hpp
Normal file
16
gen.hpp
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#pragma once
|
||||||
|
#include <vector>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
|
vector<int> generate(int N, int M) {
|
||||||
|
srand((unsigned)time(0));
|
||||||
|
|
||||||
|
auto r = vector<int>(N, 0);
|
||||||
|
for(int n = 0; n < N; n++)
|
||||||
|
r[n] = rand()%M;
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
Loading…
Reference in a new issue