-
Notifications
You must be signed in to change notification settings - Fork 0
/
generator.c
executable file
·44 lines (42 loc) · 1.31 KB
/
generator.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* generator.c
* This file is part of OpenMP-MPI-project
*
* Copyright (C) 2016 - x
*
* OpenMP-MPI-project is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* OpenMP-MPI-project is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OpenMP-MPI-project. If not, see <http://www.gnu.org/licenses/>.
*/
#include "generator.h"
int main(int argc, char *argv[]) {
/*
Check if the given arguments are more than 1.
*/
if(argc!=3){
printf("Wrong number of arguents. Exiting program");
return 0;
}
int coordinate_index = atoi(argv[2]);
int utime;
long int ltime;
int i;
ltime = time(NULL);
utime = (unsigned int) ltime/2;
FILE *file = fopen(argv[1],"w+");
srand(utime);
for(i=0;i<coordinate_index;i++){
fprintf(file,"%9.6f\n%9.6f\n%9.6f\n", (float)34*rand()/(RAND_MAX-1),(float)34*rand()/(RAND_MAX-1),(float)34*rand()/(RAND_MAX-1));
}
fclose(file);
return 0;
}