please help me find out what's wrong with the generate function because I the same result : Usage: ./generate n [s] even if I enter an argument or even change the code ? Here is the generate code : `#define _XOPEN_SOURCE





// upper limit on range of integers that can be generated

define LIMIT 65536

int main(int argc, string argv[]) { // end of program if input entered next command line argument are not two or three
if (argc != 2 && argc != 3) { printf("Usage: ./generate n [s]\n"); return 1; }

// convert the second argument into an integer value 
int n = atoi(argv[1]);

// if there is a three arguments, the third is converted into an integer, otherwise the no seed value
if (argc == 3)
    srand48((long) atoi(argv[2]));
    srand48((long) time(NULL));

// iterate the ramdon number for n amount of times until limit
for (int i = 0; i < n; i++)
    printf("%i\n", (int) (drand48() * LIMIT));

// two or./three inputs are entered and the sequence of numbers is printed
return 0;

} `

1 Answer 1


Well, I don't know what I did when verifying every line, but it works again ! Tks

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .