Subversion Repositories programming

Rev

Rev 303 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 303 Rev 304
Line 83... Line 83...
83
    {
83
    {
84
        fprintf (stderr, "Memory allocation for array failed, exiting...\n");
84
        fprintf (stderr, "Memory allocation for array failed, exiting...\n");
85
        return 2;
85
        return 2;
86
    }
86
    }
87
 
87
 
88
    /* Generate random numbers, staying in the range [1,10n] */
88
    /* Generate random numbers, staying in the range [0,10n) */
89
    for (i=0; i<n; i++)
89
    for (i=0; i<n; i++)
90
        numbers[i] = (rand() % (n*10)) + 1;
90
        numbers[i] = (int) ((n*10.0) * rand() / (RAND_MAX + 1.0));
91
 
91
 
92
    /* Find the max and min of them */
92
    /* Find the max and min of them */
93
    for (i=0; i<n; i++)
93
    for (i=0; i<n; i++)
94
    {
94
    {
95
        /* max */
95
        /* max */