Random number challenge

Alex Esplin alex.esplin at gmail.com
Wed Jun 11 20:39:38 MDT 2008


#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

int main(int argc, char* argv[]) {

    srand(time(0));
    int members = atoi(argv[1]);
    int r = rand() % members + 1;

    printf("Your number is: %d\n", r);

    return 0;
}

I can remember that every time.  I do it lots.

-- 
Alex Esplin



More information about the PLUG mailing list