summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
Diffstat (limited to 'random.c')
-rw-r--r--random.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/random.c b/random.c
index e78225cabb..e977094eaa 100644
--- a/random.c
+++ b/random.c
@@ -92,10 +92,11 @@ rb_f_srand(argc, argv, obj)
static int saved_seed;
if (rb_scan_args(argc, argv, "01", &seed) == 0) {
+ static int n = 0;
struct timeval tv;
gettimeofday(&tv, 0);
- seed = tv.tv_sec ^ tv.tv_usec ^ getpid();
+ seed = tv.tv_sec ^ tv.tv_usec ^ getpid() ^ n++;
}
else {
seed = NUM2UINT(seed);