summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-10-27 04:20:14 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-10-27 04:20:14 +0000
commitcd2af215d4d438bcb217ffce94c208e229dfe58a (patch)
tree4c7b5d05253cfd87ac3993aca8e4cb04eeb61b71 /random.c
parentcabeaac37bd55efc9adb59dcb713295bab1e3392 (diff)
unsigned seed
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r--random.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/random.c b/random.c
index e977094..fbfa94e 100644
--- a/random.c
+++ b/random.c
@@ -87,11 +87,11 @@ rb_f_srand(argc, argv, obj)
VALUE *argv;
VALUE obj;
{
- VALUE seed;
- int old;
- static int saved_seed;
+ VALUE a;
+ unsigned int seed, old;
+ static unsigned int saved_seed;
- if (rb_scan_args(argc, argv, "01", &seed) == 0) {
+ if (rb_scan_args(argc, argv, "01", &a) == 0) {
static int n = 0;
struct timeval tv;
@@ -99,7 +99,7 @@ rb_f_srand(argc, argv, obj)
seed = tv.tv_sec ^ tv.tv_usec ^ getpid() ^ n++;
}
else {
- seed = NUM2UINT(seed);
+ seed = NUM2UINT(a);
}
#ifdef HAVE_RANDOM
@@ -116,7 +116,7 @@ rb_f_srand(argc, argv, obj)
old = saved_seed;
saved_seed = seed;
- return rb_int2inum(old);
+ return rb_uint2inum(old);
}
static VALUE