Skip to content

Commit 0452ea2

Browse files
committed
merge revision(s) 18509:
* array.c (rb_ary_sample): rename #choice to #sample. in addition, sample takes optional argument, a la #first. * random.c (Init_Random): always initialize seed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@21617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 78c5478 commit 0452ea2

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Sat Jan 17 12:16:10 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
2+
3+
* random.c (Init_Random): always initialize seed.
4+
15
Fri Jan 16 10:59:31 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
26

37
* class.c (clone_method): should copy cbase in cref as well.

random.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ rb_genrand_real(void)
189189
#include <fcntl.h>
190190
#endif
191191

192-
static int first = 1;
193192
static VALUE saved_seed = INT2FIX(0);
194193

195194
static VALUE
@@ -245,7 +244,6 @@ rand_init(vseed)
245244
len--;
246245
init_by_array(buf, len);
247246
}
248-
first = 0;
249247
old = saved_seed;
250248
saved_seed = seed;
251249
free(buf);
@@ -445,9 +443,6 @@ rb_f_rand(argc, argv, obj)
445443
long val, max;
446444

447445
rb_scan_args(argc, argv, "01", &vmax);
448-
if (first) {
449-
rand_init(random_seed());
450-
}
451446
switch (TYPE(vmax)) {
452447
case T_FLOAT:
453448
if (RFLOAT(vmax)->value <= LONG_MAX && RFLOAT(vmax)->value >= LONG_MIN) {
@@ -498,6 +493,7 @@ rb_f_rand(argc, argv, obj)
498493
void
499494
Init_Random()
500495
{
496+
rand_init(random_seed());
501497
rb_define_global_function("srand", rb_f_srand, -1);
502498
rb_define_global_function("rand", rb_f_rand, -1);
503499
rb_global_variable(&saved_seed);

version.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#define RUBY_VERSION "1.8.7"
2-
#define RUBY_RELEASE_DATE "2009-01-16"
2+
#define RUBY_RELEASE_DATE "2009-01-17"
33
#define RUBY_VERSION_CODE 187
4-
#define RUBY_RELEASE_CODE 20090116
5-
#define RUBY_PATCHLEVEL 87
4+
#define RUBY_RELEASE_CODE 20090117
5+
#define RUBY_PATCHLEVEL 88
66

77
#define RUBY_VERSION_MAJOR 1
88
#define RUBY_VERSION_MINOR 8
99
#define RUBY_VERSION_TEENY 7
1010
#define RUBY_RELEASE_YEAR 2009
1111
#define RUBY_RELEASE_MONTH 1
12-
#define RUBY_RELEASE_DAY 16
12+
#define RUBY_RELEASE_DAY 17
1313

1414
#ifdef RUBY_EXTERN
1515
RUBY_EXTERN const char ruby_version[];

0 commit comments

Comments
 (0)