summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--array.c4
-rw-r--r--include/ruby/intern.h4
-rw-r--r--random.c16
4 files changed, 26 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 120d90b5d..aafb1a6d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Mon Dec 24 17:12:57 2007 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h, random.c, array.c:
+ change exported name.
+ genrand_int32 -> rb_genrand_int32.
+ genrand_real -> rb_genrand_real.
+ [ruby-core:14335]
+
Mon Dec 24 17:06:37 2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* {lib,test}/{soap,wsdl,xsd}: removed soap4r along to the discussion
diff --git a/array.c b/array.c
index ca9cc448a..0a3fb64b2 100644
--- a/array.c
+++ b/array.c
@@ -2896,7 +2896,7 @@ rb_ary_shuffle_bang(VALUE ary)
rb_ary_modify(ary);
ary_iter_check(ary);
while (i) {
- long j = genrand_real()*i;
+ long j = rb_genrand_real()*i;
VALUE tmp = RARRAY_PTR(ary)[--i];
RARRAY_PTR(ary)[i] = RARRAY_PTR(ary)[j];
RARRAY_PTR(ary)[j] = tmp;
@@ -2939,7 +2939,7 @@ rb_ary_choice(VALUE ary)
i = RARRAY_LEN(ary);
if (i == 0) return Qnil;
- j = genrand_real()*i;
+ j = rb_genrand_real()*i;
return RARRAY_PTR(ary)[j];
}
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index a16b14f0d..977f58cd6 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -442,8 +442,8 @@ VALUE rb_detach_process(rb_pid_t pid);
VALUE rb_range_new(VALUE, VALUE, int);
VALUE rb_range_beg_len(VALUE, long*, long*, long, int);
/* random.c */
-unsigned long genrand_int32(void);
-double genrand_real(void);
+unsigned long rb_genrand_int32(void);
+double rb_genrand_real(void);
/* re.c */
#define rb_memcmp memcmp
int rb_memcicmp(const void*,const void*,long);
diff --git a/random.c b/random.c
index 4e29ff11a..bb3a41e6b 100644
--- a/random.c
+++ b/random.c
@@ -145,7 +145,7 @@ next_state(void)
}
/* generates a random number on [0,0xffffffff]-interval */
-unsigned long
+static unsigned long
genrand_int32(void)
{
unsigned long y;
@@ -163,7 +163,7 @@ genrand_int32(void)
}
/* generates a random number on [0,1) with 53-bit resolution*/
-double
+static double
genrand_real(void)
{
unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;
@@ -188,6 +188,18 @@ genrand_real(void)
#include <fcntl.h>
#endif
+unsigned long
+rb_genrand_int32(void)
+{
+ return genrand_int32();
+}
+
+double
+rb_genrand_real(void)
+{
+ return genrand_real();
+}
+
static VALUE saved_seed = INT2FIX(0);
static VALUE