• R/O
  • SSH
  • HTTPS

yash: Commit


Commit MetaInfo

Revision3983 (tree)
Time2019-02-10 23:54:18
Authormagicant

Log Message

Seed $RANDOM more randomly

Now the $RANDOM variable is seeded with time as well as the process ID.

Change Summary

Incremental Difference

--- yash/trunk/variable.c (revision 3982)
+++ yash/trunk/variable.c (revision 3983)
@@ -32,6 +32,7 @@
3232 #include <stdio.h>
3333 #include <stdlib.h>
3434 #include <string.h>
35+#include <time.h>
3536 #include <unistd.h>
3637 #include <wchar.h>
3738 #include <wctype.h>
@@ -334,7 +335,7 @@
334335 v->v_value = NULL;
335336 v->v_getter = random_getter;
336337 random_active = true;
337- srand(shell_pid);
338+ srand((unsigned) time(NULL) ^ (unsigned) shell_pid << 17);
338339 } else {
339340 random_active = false;
340341 }
Show on old repository browser