summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'random.c')
-rw-r--r--random.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/random.c b/random.c
index 8dfa6729f4..e78225cabb 100644
--- a/random.c
+++ b/random.c
@@ -12,6 +12,9 @@
#include "ruby.h"
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#include <time.h>
#ifndef NT
#ifdef HAVE_SYS_TIME_H
@@ -92,7 +95,7 @@ rb_f_srand(argc, argv, obj)
struct timeval tv;
gettimeofday(&tv, 0);
- seed = tv.tv_sec ^ tv.tv_usec;
+ seed = tv.tv_sec ^ tv.tv_usec ^ getpid();
}
else {
seed = NUM2UINT(seed);