From: CoolProgrammer <coo...@ya...> - 2000-10-12 22:29:11
|
Actually, I believe there's a better way (under Linux): #include <stdio.h>void main() { FILE *random; int i; random = fopen("/dev/random", "rb"); if(!random) return; fread(&i, sizeof(int), 1, random); printf("%d", i); fclose(random); return;} This assumes that the /dev/random device is enabled, but, since the kernel obtains this data from the environment, it is truly random. These numbers are better for encryption--rand() is not so good for that. ~CoolProgrammer --------------------------------- Do You Yahoo!? Get Yahoo! Mail - Free email you can access from anywhere! |