Changeset 1022
- Timestamp:
- Sep 16, 2006, 11:43:36 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/cucul/cucul.c
r1005 r1022 24 24 # include <stdlib.h> 25 25 # include <string.h> 26 # include <time.h> 26 27 # if defined(HAVE_ERRNO_H) 27 28 # include <errno.h> 29 # endif 30 # include <sys/types.h> 31 # if defined(HAVE_UNISTD_H) 32 # include <unistd.h> 28 33 # endif 29 34 #endif … … 273 278 int cucul_rand(int min, int max) 274 279 { 280 static int need_init = 1; 281 282 if(need_init) 283 { 284 srand(getpid() + time(NULL)); 285 need_init = 0; 286 } 287 275 288 return min + (int)((1.0 * (max - min)) * rand() / (RAND_MAX + 1.0)); 276 289 }
Note: See TracChangeset
for help on using the changeset viewer.