** Use 'time' and 'clock' as sources of "randomness". Because we don't ** know the types 'clock_t' and 'time_t', we cannot cast them to ** anything without risking overflows. A safe way to use their values ** is to copy them to an array of a known type and use the array values. */
| 242 | ** is to copy them to an array of a known type and use the array values. |
| 243 | */ |
| 244 | static unsigned int l_randomizePivot (void) { |
| 245 | clock_t c = clock(); |
| 246 | time_t t = time(NULL); |
| 247 | unsigned int buff[sof(c) + sof(t)]; |
| 248 | unsigned int i, rnd = 0; |
| 249 | memcpy(buff, &c, sof(c) * sizeof(unsigned int)); |
| 250 | memcpy(buff + sof(c), &t, sof(t) * sizeof(unsigned int)); |
| 251 | for (i = 0; i < sof(buff); i++) |
| 252 | rnd += buff[i]; |
| 253 | return rnd; |
| 254 | } |
| 255 | |
| 256 | #endif /* } */ |
| 257 |