From: Jason A M. <jm...@in...> - 2000-10-11 21:31:55
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I agree. It's time to get going on this. C, C++, Objective-C, whatever... I can do 'em all. Let's just get going. :) As far as random numbers in C, here's a quick sample of how you use the system clock to generate a random seed: /* Generate a random number and print it to the screen */ #include <stdio.h> #include <stdlib.h> #include <time.h> int number; void main(void) { /* Use the time to seed the random number generator */ srand((unsigned) time(NULL)); /* Assign a random number using that seed to the 'number' variable */ number = rand(); /* Print the random number */ printf("\nThe random number generated is %d.", number); } Pretty simple really. The time function is really the best way to generate a truly random number. So anyway, just let me know what you guys want me to start working on and I'll begin coding. - -- Jason A Miller <jm...@in...> Owner, in2linux.com http://www.in2linux.com/ +1 (307) 637-0451 -----BEGIN PGP SIGNATURE----- Version: PGP 6.5.8 iQA/AwUBOeTciB3+OCqvybywEQI/0wCgvm9TIQm6WuZlH+yhOnfJeL3OzxQAn2hE FtAKYKiGnCQZclaDFuJvlrk4 =QN7a -----END PGP SIGNATURE----- |