Seed $RANDOM more randomly
Now the $RANDOM variable is seeded with time as well as the process ID.
@@ -32,6 +32,7 @@ | ||
32 | 32 | #include <stdio.h> |
33 | 33 | #include <stdlib.h> |
34 | 34 | #include <string.h> |
35 | +#include <time.h> | |
35 | 36 | #include <unistd.h> |
36 | 37 | #include <wchar.h> |
37 | 38 | #include <wctype.h> |
@@ -334,7 +335,7 @@ | ||
334 | 335 | v->v_value = NULL; |
335 | 336 | v->v_getter = random_getter; |
336 | 337 | random_active = true; |
337 | - srand(shell_pid); | |
338 | + srand((unsigned) time(NULL) ^ (unsigned) shell_pid << 17); | |
338 | 339 | } else { |
339 | 340 | random_active = false; |
340 | 341 | } |