Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.sao.ru/hq/sts/linux/book/c_marshall/section2_22_26.html
Дата изменения: Unknown Дата индексирования: Sat Sep 11 20:06:31 2010 Кодировка: |
/* random.c - simple example of setting random number seeds with time */ /* c89 random.c -o random */ #include <stdio.h> #include <sys/types.h> #include <time.h> main() { int i; time_t t1; (void) time(&t1); srand48((long) t1); /* use time in seconds to set seed */ printf("5 random numbers (Seed = %d):\n",(int) t1); for (i=0;i<5;++i) printf("%d ", lrand48()); printf("\n\n"); /* flush print buffer */ /* lrand48() returns non-negative long integers uniformly distributed over the interval (0, ~2**31) */ }