#include "ruby.h"
#include <unistd.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
Go to the source code of this file.
Defines | |
| #define | N 624 |
| #define | M 397 |
| #define | MATRIX_A 0x9908b0dfUL |
| #define | UMASK 0x80000000UL |
| #define | LMASK 0x7fffffffUL |
| #define | MIXBITS(u, v) ( ((u) & UMASK) | ((v) & LMASK) ) |
| #define | TWIST(u, v) ((MIXBITS(u,v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL)) |
| #define | BIG_GET32(big, i) (((BDIGIT *)(big)->digits)[i]) |
| #define | BIG_SET32(big, i, d) (((BDIGIT *)(big)->digits)[i] = (d)) |
Functions | |
| void | init_genrand (unsigned long s) |
| void | init_by_array (unsigned long init_key[], int key_length) |
| void | next_state () |
| unsigned long | genrand_int32 (void) |
| double | genrand_real (void) |
| VALUE | rand_init (VALUE vseed) |
| VALUE | random_seed () |
| VALUE | rb_f_srand (int argc, VALUE *argv, VALUE obj) |
| unsigned long | make_mask (unsigned long x) |
| unsigned long | limited_rand (unsigned long limit) |
| VALUE | limited_big_rand (struct RBignum *limit) |
| VALUE | rb_f_rand (int argc, VALUE *argv, VALUE obj) |
| void | Init_Random () |
Variables | |
| unsigned long | state [N] |
| int | left = 1 |
| int | initf = 0 |
| unsigned long * | next |
| int | first = 1 |
| VALUE | saved_seed = INT2FIX(0) |
|
|
Referenced by limited_big_rand(). |
|
|
Referenced by limited_big_rand(). |
|
|
|
|
|
Definition at line 65 of file random.c. Referenced by next_state(). |
|
|
|
|
|
|
|
|
Definition at line 64 of file random.c. Referenced by init_by_array(), init_genrand(), and next_state(). |
|
|
Definition at line 70 of file random.c. Referenced by next_state(). |
|
|
|
|
|
Definition at line 150 of file random.c. References left, next, and next_state(). Referenced by genrand_real(), limited_big_rand(), and limited_rand(). |
|
|
Definition at line 168 of file random.c. References genrand_int32(). Referenced by rb_f_rand(). |
|
||||||||||||
|
Definition at line 100 of file random.c. References init_genrand(), initf, left, N, and state. Referenced by rand_init(). |
|
|
Definition at line 79 of file random.c. References initf, left, N, and state. Referenced by init_by_array(), next_state(), and rand_init(). |
|
|
Definition at line 498 of file random.c. References rb_define_global_function(), rb_f_rand(), rb_f_srand(), rb_global_variable(), and saved_seed. Referenced by rb_call_inits(). |
|
|
Definition at line 374 of file random.c. References BIG_GET32, BIG_SET32, genrand_int32(), RBignum::len, make_mask(), rb_big_clone(), rb_big_norm(), SIZEOF_BDIGITS, and VALUE. Referenced by rb_f_rand(). |
|
|
Definition at line 354 of file random.c. References genrand_int32(), make_mask(), and SIZEOF_LONG. Referenced by rb_f_rand(). |
|
|
Definition at line 340 of file random.c. Referenced by limited_big_rand(), and limited_rand(). |
|
|
Definition at line 127 of file random.c. References init_genrand(), initf, left, M, N, next, state, and TWIST. Referenced by genrand_int32(). |
|
|
Definition at line 196 of file random.c. References ALLOC_N, BDIGIT, first, FIX2ULONG, FIXNUM_P, free, init_by_array(), init_genrand(), rb_eTypeError, rb_obj_classname(), rb_raise(), rb_to_int(), RBIGNUM, saved_seed, SIZEOF_BDIGITS, T_BIGNUM, T_FIXNUM, TYPE, and VALUE. Referenced by rb_f_rand(), and rb_f_srand(). |
|
|
Definition at line 256 of file random.c. References ALLOC_N, BDIGIT, NEWOBJ, OBJSETUP, rb_big_norm(), rb_cBignum, S_ISCHR, SIZEOF_BDIGITS, T_BIGNUM, timeval::tv_sec, timeval::tv_usec, and VALUE. Referenced by rb_f_rand(), and rb_f_srand(). |
|
||||||||||||||||
|
Definition at line 439 of file random.c. References first, FIX2LONG, FIXNUM_P, genrand_real(), INT2FIX, limited_big_rand(), limited_rand(), LONG2NUM, LONG_MIN, rand_init(), random_seed(), rb_big_clone(), rb_big_minus(), rb_dbl2big(), rb_float_new(), rb_Integer(), rb_scan_args(), RFLOAT, T_BIGNUM, T_FIXNUM, T_FLOAT, T_NIL, TYPE, and VALUE. Referenced by Init_Random(). |
|
||||||||||||||||
|
Definition at line 323 of file random.c. References rand_init(), random_seed(), rb_scan_args(), rb_secure(), and VALUE. Referenced by Init_Random(). |
|
|
Definition at line 192 of file random.c. Referenced by rand_init(), and rb_f_rand(). |
|
|
Definition at line 74 of file random.c. Referenced by init_by_array(), init_genrand(), and next_state(). |
|
|
Definition at line 73 of file random.c. Referenced by genrand_int32(), init_by_array(), init_genrand(), and next_state(). |
|
|
Definition at line 75 of file random.c. Referenced by genrand_int32(), and next_state(). |
|
|
Definition at line 193 of file random.c. Referenced by Init_Random(), and rand_init(). |
|
|
Definition at line 72 of file random.c. Referenced by init_by_array(), init_genrand(), and next_state(). |
1.3.5