From e5d00b1b2e2e7c0684dae7324feb86c36188047b Mon Sep 17 00:00:00 2001 From: hanemile Date: Tue, 16 Jan 2018 15:56:49 +0100 Subject: updated the source --- src/c/run.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/c/run.c') diff --git a/src/c/run.c b/src/c/run.c index 838d294..6a95e82 100644 --- a/src/c/run.c +++ b/src/c/run.c @@ -32,7 +32,8 @@ int main(int argc, char *argv[] ){ // define an array to store the coordinates of the stars in - FILE * st = fopen("stars/1.csv", "w+"); + char *star_file = "stars/1.csv"; + FILE * st = fopen(star_file, "w+"); /* Generate random coordinates @@ -40,6 +41,9 @@ int main(int argc, char *argv[] ){ printf(">>> Generating %d random coordinates\n", num_of_stars); + printf(" -> Writing data to '%s'\n", star_file); + + // generate the random coordinates for(int i = 0; i < num_of_stars; i++){ int x = rand() % (range_max - range_min + 1) + range_min; @@ -63,6 +67,7 @@ int main(int argc, char *argv[] ){ */ printf(">>> Generating a lookuptable\n"); + char *filename = "testFile.csv"; // If the correct amount (2) of command line arguments are given, continue if( argc == 2 ) { @@ -70,8 +75,6 @@ int main(int argc, char *argv[] ){ // Print out how many stars are being generated printf(" -> Generating %d Values...\n", num_of_stars); - char *filename = "testFile.csv"; - printf(" -> Writing data to '%s'\n", filename); // Open a file into which the lookuptable wil be written @@ -84,7 +87,7 @@ int main(int argc, char *argv[] ){ } // generate the lookuptable - for(int i = 0; i < num_of_stars; i++){ + for(int i = 0; i < range_max; i = i + (range_max) / num_of_stars){ fprintf(fp, "%d, %f\n", i, phi(i)); } -- cgit 1.4.1