about summary refs log tree commit diff
path: root/src/c/run.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/c/run.c')
-rw-r--r--src/c/run.c11
1 files changed, 7 insertions, 4 deletions
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));
     }