зеркало из https://github.com/github/ruby.git
* 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
This commit is contained in:
Родитель
889c7de09d
Коммит
30f1eb1856
|
@ -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
|
||||
|
|
4
array.c
4
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];
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
16
random.c
16
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче