Browse Source

Updated randomtrace.c. Start from zero, comma separation.

Joshua Rutschmann 8 years ago
parent
commit
bd8240f733
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      hw4/simu3/randomtrace.c

+ 6
- 2
hw4/simu3/randomtrace.c View File

14
   s = atoi(argv[1]);
14
   s = atoi(argv[1]);
15
   t = atoi(argv[2]);
15
   t = atoi(argv[2]);
16
   for (i = 0; i < s; i++) {
16
   for (i = 0; i < s; i++) {
17
-    r = (int) ((rand() % t) + 1);
18
-    printf("%d ", r);
17
+    r = (int) ((rand() % t));
18
+    if (i != s - 1) {
19
+      printf("%d,", r);
20
+    } else {
21
+      printf("%d", r);
22
+    }
19
   }
23
   }
20
   printf("\n");
24
   printf("\n");
21
 }
25
 }

Loading…
Cancel
Save