Changeset c718bda in mainline
- Timestamp:
- 2018-01-15T21:40:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dbbbe75b
- Parents:
- ba29018
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-15 21:20:07)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-15 21:40:49)
- Location:
- uspace
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tetris/tetris.c
rba29018 rc718bda 156 156 const struct shape *randshape(void) 157 157 { 158 const struct shape *tmp = &shapes[rand om() % 7];158 const struct shape *tmp = &shapes[rand() % 7]; 159 159 int i; 160 int j = rand om() % 4;160 int j = rand() % 4; 161 161 162 162 for (i = 0; i < j; i++) … … 171 171 172 172 gettimeofday(&tv, NULL); 173 srand om(tv.tv_sec + tv.tv_usec / 100000);173 srand(tv.tv_sec + tv.tv_usec / 100000); 174 174 } 175 175 -
uspace/dist/src/c/demos/tetris/tetris.c
rba29018 rc718bda 157 157 const struct shape *randshape(void) 158 158 { 159 const struct shape *tmp = &shapes[rand om() % 7];159 const struct shape *tmp = &shapes[rand() % 7]; 160 160 int i; 161 int j = rand om() % 4;161 int j = rand() % 4; 162 162 163 163 for (i = 0; i < j; i++) … … 172 172 173 173 gettimeofday(&tv, NULL); 174 srand om(tv.tv_sec + tv.tv_usec / 100000);174 srand(tv.tv_sec + tv.tv_usec / 100000); 175 175 } 176 176 -
uspace/lib/c/generic/stdlib.c
rba29018 rc718bda 35 35 #include <stdlib.h> 36 36 37 static longglbl_seed = 1;37 static int glbl_seed = 1; 38 38 39 long int random(void)39 int rand(void) 40 40 { 41 41 return glbl_seed = ((1366 * glbl_seed + 150889) % RAND_MAX); 42 42 } 43 43 44 void srand om(unsigned int seed)44 void srand(unsigned int seed) 45 45 { 46 46 glbl_seed = seed % RAND_MAX; -
uspace/lib/c/generic/uuid.c
rba29018 rc718bda 52 52 /* XXX This is a rather poor way of generating random numbers */ 53 53 gettimeofday(&tv, NULL); 54 srand om(tv.tv_sec ^ tv.tv_usec);54 srand(tv.tv_sec ^ tv.tv_usec); 55 55 56 56 for (i = 0; i < uuid_bytes; i++) 57 uuid->b[i] = rand om();57 uuid->b[i] = rand(); 58 58 59 59 /* Version 4 UUID from random or pseudo-random numbers */ -
uspace/lib/c/include/stdlib.h
rba29018 rc718bda 42 42 #define RAND_MAX 714025 43 43 44 #define rand() random() 45 #define srand(seed) srandom(seed) 46 47 extern long int random(void); 48 extern void srandom(unsigned int seed); 44 extern int rand(void); 45 extern void srand(unsigned int seed); 49 46 50 47 extern void abort(void) __attribute__((noreturn)); -
uspace/lib/posix/source/stdlib.c
rba29018 rc718bda 377 377 int posix_rand(void) 378 378 { 379 return (int) rand om();379 return (int) rand(); 380 380 } 381 381 … … 387 387 void posix_srand(unsigned int seed) 388 388 { 389 srand om(seed);389 srand(seed); 390 390 } 391 391 -
uspace/srv/net/tcp/ncsim.c
rba29018 rc718bda 81 81 return; 82 82 83 if (0 /*rand om() % 4 == 3*/) {83 if (0 /*rand() % 4 == 3*/) { 84 84 /* Drop segment */ 85 85 log_msg(LOG_DEFAULT, LVL_ERROR, "NCSim dropping segment"); … … 94 94 } 95 95 96 sqe->delay = rand om() % (1000 * 1000);96 sqe->delay = rand() % (1000 * 1000); 97 97 sqe->epp = *epp; 98 98 sqe->seg = seg;
Note:
See TracChangeset
for help on using the changeset viewer.