Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

randomtrace.c 382B

123456789101112131415161718192021
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. int main(int argc, char* argv[]) {
  5. srand(time(NULL));
  6. if (argc != 3) {
  7. fprintf(stderr, "Usage: ./randomtrace <count> <size>\n");
  8. return -1;
  9. }
  10. int i, r, s, t;
  11. s = atoi(argv[1]);
  12. t = atoi(argv[2]);
  13. for (i = 0; i < s; i++) {
  14. r = (int) ((rand() % t) + 1);
  15. printf("%d ", r);
  16. }
  17. printf("\n");
  18. }