Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

randomtrace.c 442B

12345678910111213141516171819202122232425
  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);
  15. if (i != s - 1) {
  16. printf("%d,", r);
  17. } else {
  18. printf("%d", r);
  19. }
  20. }
  21. printf("\n");
  22. }