src/util.c

changeset 294
4df350dac84f
parent 273
966bfca56b9d
equal deleted inserted replaced
293:24b0f47f619c 294:4df350dac84f
39 SDL_srand(seed); 39 SDL_srand(seed);
40 } 40 }
41 41
42 uint32_t asc_util_rand(uint32_t n) { 42 uint32_t asc_util_rand(uint32_t n) {
43 if (n > INT32_MAX) { 43 if (n > INT32_MAX) {
44 // TODO: this probably uses quality of the generated numbers 44 // TODO: this likely reduces the quality of the generated numbers
45 return SDL_rand_bits() % n; 45 return SDL_rand_bits() % n;
46 } else { 46 } else {
47 return SDL_rand((int32_t) n); 47 return SDL_rand((int32_t) n);
48 } 48 }
49 } 49 }

mercurial