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 6d20190404..8487277efb 100644
--- a/random.c
+++ b/random.c
@@ -332,9 +332,12 @@ rb_f_srand(int argc, VALUE *argv, VALUE obj)
VALUE seed, old;
rb_secure(4);
- if (rb_scan_args(argc, argv, "01", &seed) == 0) {
+ if (argc == 0) {
seed = random_seed();
}
+ else {
+ rb_scan_args(argc, argv, "01", &seed);
+ }
old = rand_init(seed);
return old;