aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-24 08:19:28 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-24 08:19:28 +0000
commit30f1eb1856eae8b310fe6440dfcab95b6fe76046 (patch)
treec2a0a16e7b7e050ff949c80cbddafee52b1d6e74
parent889c7de09d40ebdd3620cf9c0ad74d750b512221 (diff)
downloadruby-30f1eb1856eae8b310fe6440dfcab95b6fe76046.tar.gz
* include/ruby/intern.h, random.c, array.c:
change exported name. genrand_int32 -> rb_genrand_int32. genrand_real -> rb_genrand_real. [ruby-core:14335] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-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 120d90b5d9..aafb1a6d6a 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 ca9cc448a0..0a3fb64b24 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 a16b14f0dc..977f58cd69 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 4e29ff11a5..bb3a41e6b2 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