#include "ruby/ruby.h"#include "internal.h"#include <limits.h>#include <time.h>#include <sys/types.h>#include <sys/stat.h>#include <math.h>#include <errno.h>#include "siphash.c"Go to the source code of this file.
Data Structures | |
| struct | MT |
| struct | rb_random_t |
Defines | |
| #define | N 624 |
| #define | M 397 |
| #define | MATRIX_A 0x9908b0dfU |
| #define | UMASK 0x80000000U |
| #define | LMASK 0x7fffffffU |
| #define | MIXBITS(u, v) ( ((u) & UMASK) | ((v) & LMASK) ) |
| #define | TWIST(u, v) ((MIXBITS((u),(v)) >> 1) ^ ((v)&1U ? MATRIX_A : 0U)) |
| #define | genrand_initialized(mt) ((mt)->next != 0) |
| #define | uninit_genrand(mt) ((mt)->next = 0) |
| #define | DEFAULT_SEED_CNT 4 |
| #define | SIZEOF_INT32 (31/CHAR_BIT + 1) |
| #define | id_minus '-' |
| #define | id_plus '+' |
| #define | DEFAULT_SEED_LEN (DEFAULT_SEED_CNT * (int)sizeof(int32_t)) |
| #define | USE_DEV_URANDOM 1 |
| #define | SIP_HASH_STREAMING 0 |
| #define | sip_hash24 ruby_sip_hash24 |
| #define | BYTE_ORDER LITTLE_ENDIAN |
| #define | LITTLE_ENDIAN 1234 |
| #define | BIG_ENDIAN 4321 |
Typedefs | |
| typedef int | int_must_be_32bit_at_least [sizeof(int)*CHAR_BIT< 32?-1:1] |
Enumerations | |
| enum | { MT_MAX_STATE = N } |
Functions | |
| static void | init_genrand (struct MT *mt, unsigned int s) |
| static void | init_by_array (struct MT *mt, unsigned int init_key[], int key_length) |
| static void | next_state (struct MT *mt) |
| static unsigned int | genrand_int32 (struct MT *mt) |
| static double | genrand_real (struct MT *mt) |
| static double | int_pair_to_real_inclusive (uint32_t a, uint32_t b) |
| static double | genrand_real2 (struct MT *mt) |
| static VALUE | rand_init (struct MT *mt, VALUE vseed) |
| static VALUE | random_seed (void) |
| static rb_random_t * | rand_start (rb_random_t *r) |
| static struct MT * | default_mt (void) |
| unsigned int | rb_genrand_int32 (void) |
| double | rb_genrand_real (void) |
| static void | random_mark (void *ptr) |
| static void | random_free (void *ptr) |
| static size_t | random_memsize (const void *ptr) |
| static rb_random_t * | get_rnd (VALUE obj) |
| static rb_random_t * | try_get_rnd (VALUE obj) |
| static VALUE | random_alloc (VALUE klass) |
| static VALUE | random_init (int argc, VALUE *argv, VALUE obj) |
| static void | fill_random_seed (uint32_t seed[DEFAULT_SEED_CNT]) |
| static VALUE | make_seed_value (const uint32_t *ptr) |
| static VALUE | random_get_seed (VALUE obj) |
| static VALUE | random_copy (VALUE obj, VALUE orig) |
| static VALUE | mt_state (const struct MT *mt) |
| static VALUE | random_state (VALUE obj) |
| static VALUE | random_s_state (VALUE klass) |
| static VALUE | random_left (VALUE obj) |
| static VALUE | random_s_left (VALUE klass) |
| static VALUE | random_dump (VALUE obj) |
| static VALUE | random_load (VALUE obj, VALUE dump) |
| static VALUE | rb_f_srand (int argc, VALUE *argv, VALUE obj) |
| static unsigned long | make_mask (unsigned long x) |
| static unsigned long | limited_rand (struct MT *mt, unsigned long limit) |
| static VALUE | limited_big_rand (struct MT *mt, VALUE limit) |
| unsigned long | rb_genrand_ulong_limited (unsigned long limit) |
| unsigned int | rb_random_int32 (VALUE obj) |
| double | rb_random_real (VALUE obj) |
| static VALUE | ulong_to_num_plus_1 (unsigned long n) |
| unsigned long | rb_random_ulong_limited (VALUE obj, unsigned long limit) |
| static VALUE | random_bytes (VALUE obj, VALUE len) |
| VALUE | rb_random_bytes (VALUE obj, long n) |
| static VALUE | range_values (VALUE vmax, VALUE *begp, VALUE *endp, int *exclp) |
| static VALUE | rand_int (struct MT *mt, VALUE vmax, int restrictive) |
| static double | float_value (VALUE v) |
| static VALUE | rand_range (struct MT *mt, VALUE range) |
| static VALUE | rand_random (int argc, VALUE *argv, rb_random_t *rnd) |
| static VALUE | random_rand (int argc, VALUE *argv, VALUE obj) |
| static VALUE | random_equal (VALUE self, VALUE other) |
| static VALUE | rb_f_rand (int argc, VALUE *argv, VALUE obj) |
| static VALUE | random_s_rand (int argc, VALUE *argv, VALUE obj) |
| static VALUE | init_randomseed (struct MT *mt, uint32_t initial[DEFAULT_SEED_CNT]) |
| void | Init_RandomSeed (void) |
| st_index_t | rb_hash_start (st_index_t h) |
| st_index_t | rb_memhash (const void *ptr, long len) |
| static void | Init_RandomSeed2 (void) |
| void | rb_reset_random_seed (void) |
| void | Init_Random (void) |
Variables | |
| static rb_random_t | default_rand |
| VALUE | rb_cRandom |
| static ID | id_rand |
| static ID | id_bytes |
| static const rb_data_type_t | random_data_type |
| static st_index_t | hashseed |
| union { | |
| uint8_t key [16] | |
| uint32_t u32 [(16 *sizeof(uint8_t)-1)/sizeof(uint32_t)] | |
| } | sipseed |
| #define BYTE_ORDER LITTLE_ENDIAN |
Definition at line 1237 of file random.c.
Referenced by SHA256_Transform(), and SHA512_Transform().
| #define DEFAULT_SEED_CNT 4 |
Definition at line 227 of file random.c.
Referenced by Init_RandomSeed(), make_seed_value(), and random_seed().
| #define DEFAULT_SEED_LEN (DEFAULT_SEED_CNT * (int)sizeof(int32_t)) |
Definition at line 429 of file random.c.
Referenced by fill_random_seed(), and init_randomseed().
| #define genrand_initialized | ( | mt | ) | ((mt)->next != 0) |
Definition at line 110 of file random.c.
Referenced by rand_start().
| #define id_minus '-' |
Definition at line 307 of file random.c.
Referenced by range_values().
| #define id_plus '+' |
Definition at line 308 of file random.c.
Referenced by rand_range().
| #define LITTLE_ENDIAN 1234 |
Definition at line 1240 of file random.c.
Referenced by SHA256_Transform(), and SHA512_Transform().
| #define M 397 |
Definition at line 94 of file random.c.
Referenced by next_state(), and usage().
| #define sip_hash24 ruby_sip_hash24 |
Definition at line 1232 of file random.c.
Referenced by rb_memhash().
| #define SIZEOF_INT32 (31/CHAR_BIT + 1) |
Definition at line 264 of file random.c.
Referenced by limited_rand(), rand_init(), and rb_random_bytes().
| #define TWIST | ( | u, | |||
| v | ) | ((MIXBITS((u),(v)) >> 1) ^ ((v)&1U ? MATRIX_A : 0U)) |
Definition at line 99 of file random.c.
Referenced by next_state().
| #define uninit_genrand | ( | mt | ) | ((mt)->next = 0) |
Definition at line 111 of file random.c.
Referenced by rb_reset_random_seed().
| typedef int int_must_be_32bit_at_least[sizeof(int)*CHAR_BIT< 32?-1:1] |
| static struct MT* default_mt | ( | void | ) | [static, read] |
Definition at line 245 of file random.c.
References rb_random_t::mt, and rand_start().
Referenced by rb_f_rand(), rb_genrand_int32(), rb_genrand_real(), and rb_genrand_ulong_limited().
| static void fill_random_seed | ( | uint32_t | seed[DEFAULT_SEED_CNT] | ) | [static] |
Definition at line 438 of file random.c.
References CHAR_BIT, DEFAULT_SEED_LEN, fstat, gettimeofday(), NULL, O_NONBLOCK, rb_cloexec_open(), rb_update_max_fd(), S_ISCHR, stat, timeval::tv_sec, and timeval::tv_usec.
Referenced by init_randomseed(), and random_seed().
| static double float_value | ( | VALUE | v | ) | [inline, static] |
Definition at line 959 of file random.c.
References INT2FIX, isinf(), isnan, rb_class_new_instance(), rb_eSystemCallError, rb_exc_raise(), and RFLOAT_VALUE.
Referenced by rand_random(), and rand_range().
| static unsigned int genrand_int32 | ( | struct MT * | mt | ) | [static] |
Definition at line 181 of file random.c.
References MT::left, MT::next, and next_state().
Referenced by genrand_real(), genrand_real2(), Init_RandomSeed(), limited_big_rand(), limited_rand(), rb_genrand_int32(), rb_random_bytes(), and rb_random_int32().
| static double genrand_real | ( | struct MT * | mt | ) | [static] |
Definition at line 200 of file random.c.
References genrand_int32().
Referenced by rand_random(), rand_range(), rb_f_rand(), rb_genrand_real(), and rb_random_real().
| static double genrand_real2 | ( | struct MT * | mt | ) | [static] |
Definition at line 210 of file random.c.
References genrand_int32(), and int_pair_to_real_inclusive().
Referenced by rand_range().
| static rb_random_t* get_rnd | ( | VALUE | obj | ) | [static] |
Definition at line 342 of file random.c.
References random_data_type, and TypedData_Get_Struct.
Referenced by random_copy(), random_dump(), random_equal(), random_get_seed(), random_init(), random_left(), random_load(), random_rand(), and random_state().
| static void init_by_array | ( | struct MT * | mt, | |
| unsigned int | init_key[], | |||
| int | key_length | |||
| ) | [static] |
Definition at line 136 of file random.c.
References init_genrand(), N, and MT::state.
Referenced by init_randomseed(), and rand_init().
| static void init_genrand | ( | struct MT * | mt, | |
| unsigned int | s | |||
| ) | [static] |
Definition at line 115 of file random.c.
References MT::left, N, MT::next, and MT::state.
Referenced by init_by_array(), and rand_init().
| void Init_Random | ( | void | ) |
Definition at line 1355 of file random.c.
References CLASS_OF, id_bytes, id_rand, Init_RandomSeed2(), random_alloc(), random_bytes(), random_copy(), random_data_type, random_dump(), random_equal(), random_get_seed(), random_init(), random_left(), random_load(), random_rand(), random_s_left(), random_s_rand(), random_s_state(), random_seed(), random_state(), rb_cObject, rb_cRandom, rb_define_alloc_func(), rb_define_class(), rb_define_const(), rb_define_global_function(), rb_define_method(), rb_define_private_method(), rb_define_singleton_method(), rb_f_rand(), rb_f_srand(), rb_gc_register_mark_object(), rb_intern, and TypedData_Wrap_Struct.
| void Init_RandomSeed | ( | void | ) |
Definition at line 1266 of file random.c.
References DEFAULT_SEED_CNT, genrand_int32(), hashseed, init_randomseed(), rb_random_t::mt, numberof, rb_global_variable(), rb_random_t::seed, and sipseed.
Definition at line 1255 of file random.c.
References DEFAULT_SEED_LEN, fill_random_seed(), init_by_array(), and make_seed_value().
Referenced by Init_RandomSeed().
| static void Init_RandomSeed2 | ( | void | ) | [static] |
Definition at line 1313 of file random.c.
References rb_cBignum, rb_obj_reveal(), RB_TYPE_P, rb_random_t::seed, and T_BIGNUM.
Referenced by Init_Random().
Definition at line 267 of file random.c.
References FIX2ULONG, FIXNUM_P, INTEGER_PACK_FORCE_BIGNUM, INTEGER_PACK_MSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, numberof, rb_big_mul(), rb_integer_pack(), and rb_integer_unpack().
Referenced by genrand_real2().
| static VALUE limited_big_rand | ( | struct MT * | mt, | |
| VALUE | limit | |||
| ) | [static] |
Definition at line 734 of file random.c.
References ALLOCV_END, ALLOCV_N, genrand_int32(), INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, make_mask(), NULL, rb_absint_numwords(), rb_integer_pack(), rb_integer_unpack(), and val.
Referenced by rand_int(), and rand_range().
| static unsigned long limited_rand | ( | struct MT * | mt, | |
| unsigned long | limit | |||
| ) | [static] |
Definition at line 712 of file random.c.
References genrand_int32(), make_mask(), SIZEOF_INT32, and val.
Referenced by rand_int(), rand_range(), rb_genrand_ulong_limited(), and rb_random_ulong_limited().
| static unsigned long make_mask | ( | unsigned long | x | ) | [static] |
Definition at line 698 of file random.c.
Referenced by limited_big_rand(), and limited_rand().
| static VALUE make_seed_value | ( | const uint32_t * | ptr | ) | [static] |
Definition at line 489 of file random.c.
References buf, DEFAULT_SEED_CNT, INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, MEMCPY, and rb_integer_unpack().
Referenced by init_randomseed(), and random_seed().
| static VALUE mt_state | ( | const struct MT * | mt | ) | [static] |
Definition at line 567 of file random.c.
References INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, numberof, rb_integer_unpack(), and MT::state.
Referenced by random_dump(), random_s_state(), and random_state().
| static void next_state | ( | struct MT * | mt | ) | [static] |
| static VALUE rand_init | ( | struct MT * | mt, | |
| VALUE | vseed | |||
| ) | [static] |
Definition at line 370 of file random.c.
References ALLOC_N, buf, init_by_array(), init_genrand(), INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, NULL, numberof, rb_absint_numwords(), rb_integer_pack(), rb_to_int(), SIZEOF_INT32, and xfree.
Referenced by rand_start(), random_init(), and rb_f_srand().
| static VALUE rand_int | ( | struct MT * | mt, | |
| VALUE | vmax, | |||
| int | restrictive | |||
| ) | [static] |
Definition at line 922 of file random.c.
References FIX2LONG, FIXNUM_P, INT2FIX, limited_big_rand(), limited_rand(), LONG2NUM, max(), Qnil, rb_big_minus(), rb_big_uminus(), rb_bigzero_p(), RB_GC_GUARD, RBIGNUM_SIGN, and ULONG2NUM.
Referenced by rand_random(), and rb_f_rand().
| static VALUE rand_random | ( | int | argc, | |
| VALUE * | argv, | |||
| rb_random_t * | rnd | |||
| ) | [static] |
Definition at line 1088 of file random.c.
References float_value(), genrand_real(), max(), rb_random_t::mt, NIL_P, NUM2LONG, Qfalse, Qnil, rand_int(), rand_range(), rb_check_arity, rb_check_to_float(), rb_check_to_integer(), rb_eArgError, rb_exc_new3, rb_exc_raise(), rb_float_new, rb_obj_as_string(), rb_str_append(), rb_str_new_cstr(), RB_TYPE_P, and T_FLOAT.
Referenced by random_rand(), and random_s_rand().
| static VALUE rand_range | ( | struct MT * | mt, | |
| VALUE | range | |||
| ) | [inline, static] |
Definition at line 970 of file random.c.
References BUILTIN_TYPE, DBL2NUM, f, FIX2LONG, FIXNUM_P, float_value(), genrand_real(), genrand_real2(), id_plus, INT2FIX, isinf(), limited_big_rand(), limited_rand(), LONG2NUM, max(), NIL_P, Qfalse, Qnil, Qundef, range_values(), rb_big_minus(), rb_big_norm(), rb_big_plus(), rb_bigzero_p(), rb_check_to_float(), rb_check_to_integer(), rb_float_new, rb_funcall2, rb_to_float(), RB_TYPE_P, RBIGNUM_SIGN, RFLOAT_VALUE, T_BIGNUM, T_FLOAT, T_NIL, TYPE, and ULONG2NUM.
Referenced by rand_random(), and rb_f_rand().
| static rb_random_t* rand_start | ( | rb_random_t * | r | ) | [static] |
Definition at line 235 of file random.c.
References genrand_initialized, rb_random_t::mt, rand_init(), random_seed(), and rb_random_t::seed.
Referenced by default_mt(), random_s_rand(), and try_get_rnd().
| static VALUE random_alloc | ( | VALUE | klass | ) | [static] |
Definition at line 361 of file random.c.
References INT2FIX, random_data_type, rb_random_t::seed, and TypedData_Make_Struct.
Referenced by Init_Random().
| static VALUE random_bytes | ( | VALUE | obj, | |
| VALUE | len | |||
| ) | [static] |
Definition at line 871 of file random.c.
References NUM2LONG, rb_random_bytes(), and rb_to_int().
Referenced by Init_Random().
| static VALUE random_copy | ( | VALUE | obj, | |
| VALUE | orig | |||
| ) | [static] |
Definition at line 550 of file random.c.
References get_rnd(), MT::left, rb_random_t::mt, MT::next, numberof, OBJ_INIT_COPY, and MT::state.
Referenced by Init_Random().
| static VALUE random_dump | ( | VALUE | obj | ) | [static] |
Definition at line 606 of file random.c.
References get_rnd(), INT2FIX, MT::left, rb_random_t::mt, mt_state(), rb_ary_new2, rb_ary_push(), and rb_random_t::seed.
Referenced by Init_Random().
| static VALUE random_equal | ( | VALUE | self, | |
| VALUE | other | |||
| ) | [static] |
Definition at line 1153 of file random.c.
References get_rnd(), MT::left, memcmp(), rb_random_t::mt, MT::next, Qfalse, Qtrue, rb_funcall2, rb_intern, rb_obj_class(), RTEST, rb_random_t::seed, and MT::state.
Referenced by Init_Random().
| static void random_free | ( | void * | ptr | ) | [static] |
| static VALUE random_get_seed | ( | VALUE | obj | ) | [static] |
Definition at line 543 of file random.c.
References get_rnd(), and rb_random_t::seed.
Referenced by Init_Random().
| static VALUE random_init | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | obj | |||
| ) | [static] |
Definition at line 412 of file random.c.
References get_rnd(), rb_random_t::mt, rand_init(), random_seed(), rb_check_copyable(), rb_check_frozen, rb_scan_args(), and rb_random_t::seed.
Referenced by Init_Random().
| static VALUE random_left | ( | VALUE | obj | ) | [static] |
Definition at line 591 of file random.c.
References get_rnd(), INT2FIX, MT::left, and rb_random_t::mt.
Referenced by Init_Random().
| static VALUE random_load | ( | VALUE | obj, | |
| VALUE | dump | |||
| ) | [static] |
Definition at line 620 of file random.c.
References Check_Type, get_rnd(), INT2FIX, INTEGER_PACK_LSWORD_FIRST, INTEGER_PACK_NATIVE_BYTE_ORDER, MT::left, rb_random_t::mt, MT::next, NUM2ULONG, numberof, RARRAY_CONST_PTR, RARRAY_LEN, rb_check_copyable(), rb_eArgError, rb_integer_pack(), rb_raise(), rb_to_int(), rb_random_t::seed, MT::state, and T_ARRAY.
Referenced by Init_Random().
| static void random_mark | ( | void * | ptr | ) | [static] |
Definition at line 313 of file random.c.
References rb_gc_mark().
| static VALUE random_rand | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | obj | |||
| ) | [static] |
Definition at line 1082 of file random.c.
References get_rnd(), and rand_random().
Referenced by Init_Random().
| static VALUE random_s_left | ( | VALUE | klass | ) | [static] |
Definition at line 599 of file random.c.
References INT2FIX, MT::left, and rb_random_t::mt.
Referenced by Init_Random().
| static VALUE random_s_rand | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | obj | |||
| ) | [static] |
Definition at line 1226 of file random.c.
References rand_random(), and rand_start().
Referenced by Init_Random().
| static VALUE random_s_state | ( | VALUE | klass | ) | [static] |
Definition at line 584 of file random.c.
References rb_random_t::mt, and mt_state().
Referenced by Init_Random().
| static VALUE random_seed | ( | void | ) | [static] |
Definition at line 521 of file random.c.
References buf, DEFAULT_SEED_CNT, fill_random_seed(), and make_seed_value().
Referenced by Init_Random(), rand_start(), random_init(), and rb_f_srand().
| static VALUE random_state | ( | VALUE | obj | ) | [static] |
Definition at line 576 of file random.c.
References get_rnd(), rb_random_t::mt, and mt_state().
Referenced by Init_Random().
| static VALUE range_values | ( | VALUE | vmax, | |
| VALUE * | begp, | |||
| VALUE * | endp, | |||
| int * | exclp | |||
| ) | [static] |
Definition at line 909 of file random.c.
References id_minus, NIL_P, Qfalse, rb_funcall2, rb_range_values(), and rb_respond_to().
Referenced by rand_range().
| static VALUE rb_f_rand | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | obj | |||
| ) | [static] |
Definition at line 1198 of file random.c.
References DBL2NUM, default_mt(), genrand_real(), INT2FIX, NIL_P, Qfalse, rand_int(), rand_range(), rb_scan_args(), and rb_to_int().
Referenced by Init_Random().
| static VALUE rb_f_srand | ( | int | argc, | |
| VALUE * | argv, | |||
| VALUE | obj | |||
| ) | [static] |
Definition at line 680 of file random.c.
References rb_random_t::mt, rand_init(), random_seed(), rb_scan_args(), and rb_random_t::seed.
Referenced by Init_Random().
| unsigned int rb_genrand_int32 | ( | void | ) |
Definition at line 251 of file random.c.
References default_mt(), and genrand_int32().
| double rb_genrand_real | ( | void | ) |
Definition at line 258 of file random.c.
References default_mt(), and genrand_real().
| unsigned long rb_genrand_ulong_limited | ( | unsigned long | limit | ) |
Definition at line 789 of file random.c.
References default_mt(), and limited_rand().
Referenced by bary_sparse_p().
| st_index_t rb_hash_start | ( | st_index_t | h | ) |
Definition at line 1296 of file random.c.
References hashseed, and st_hash_start.
Referenced by match_hash(), method_hash(), proc_hash(), range_hash(), rb_ary_hash(), rb_hash_hash(), rb_objid_hash(), and rb_struct_hash().
| st_index_t rb_memhash | ( | const void * | ptr, | |
| long | len | |||
| ) |
Definition at line 1302 of file random.c.
References sip_hash24, sipseed, and sip_uint64_t::u32.
Referenced by BigDecimal_hash(), d_lite_hash(), match_hash(), nucomp_hash(), nurat_hash(), rb_big_hash(), rb_dbl_hash(), rb_str_hash(), and reg_hash().
| VALUE rb_random_bytes | ( | VALUE | obj, | |
| long | n | |||
| ) |
Definition at line 877 of file random.c.
References CHAR_BIT, genrand_int32(), id_bytes, LONG2NUM, rb_random_t::mt, rb_funcall2, rb_str_new(), RSTRING_PTR, SIZEOF_INT32, and try_get_rnd().
Referenced by random_bytes().
| unsigned int rb_random_int32 | ( | VALUE | obj | ) |
Definition at line 795 of file random.c.
References genrand_int32(), id_rand, INT2FIX, rb_random_t::mt, NUM2ULONG, rb_big_plus(), rb_funcall2, try_get_rnd(), and ULONG2NUM.
| double rb_random_real | ( | VALUE | obj | ) |
Definition at line 812 of file random.c.
References genrand_real(), id_rand, rb_random_t::mt, NUM2DBL, rb_eRangeError, rb_funcall2, rb_raise(), and try_get_rnd().
| unsigned long rb_random_ulong_limited | ( | VALUE | obj, | |
| unsigned long | limit | |||
| ) |
Definition at line 843 of file random.c.
References id_rand, limited_rand(), rb_random_t::mt, NUM2ULONG, rb_eRangeError, rb_funcall2, rb_num_negative_p(), rb_raise(), rb_to_int(), try_get_rnd(), and ulong_to_num_plus_1().
| void rb_reset_random_seed | ( | void | ) |
Definition at line 1323 of file random.c.
References INT2FIX, rb_random_t::mt, rb_random_t::seed, and uninit_genrand.
Referenced by rb_thread_atfork().
| static rb_random_t* try_get_rnd | ( | VALUE | obj | ) | [static] |
Definition at line 350 of file random.c.
References DATA_PTR, NULL, rand_start(), random_data_type, rb_cRandom, and rb_typeddata_is_kind_of().
Referenced by rb_random_bytes(), rb_random_int32(), rb_random_real(), and rb_random_ulong_limited().
| static VALUE ulong_to_num_plus_1 | ( | unsigned long | n | ) | [inline, static] |
Definition at line 830 of file random.c.
References INT2FIX, rb_big_plus(), and ULONG2NUM.
Referenced by rb_random_ulong_limited().
rb_random_t default_rand [static] |
st_index_t hashseed [static] |
Definition at line 1248 of file random.c.
Referenced by Init_RandomSeed(), and rb_hash_start().
ID id_bytes [static] |
Definition at line 309 of file random.c.
Referenced by Init_Random(), and rb_random_bytes().
ID id_rand [static] |
Definition at line 309 of file random.c.
Referenced by Init_Random(), rb_random_int32(), rb_random_real(), and rb_random_ulong_limited().
Definition at line 1250 of file random.c.
Referenced by cbsubst_get_subst_key(), check_exec_env_i(), check_exec_options_i(), check_exec_options_i_extract(), constat_delete(), cto_i(), cv_i(), fc_i(), fdbm_clear(), fdbm_delete(), fdbm_delete_if(), fdbm_each_key(), fdbm_each_pair(), fdbm_each_value(), fdbm_empty_p(), fdbm_fetch(), fdbm_has_key(), fdbm_has_value(), fdbm_invert(), fdbm_key(), fdbm_keys(), fdbm_length(), fdbm_select(), fdbm_shift(), fdbm_store(), fdbm_to_a(), fdbm_to_hash(), fdbm_values(), fgdbm_clear(), fgdbm_empty_p(), fgdbm_has_key(), fgdbm_length(), fgdbm_store(), fgdbm_values(), fill_envp_buf_i(), fsdbm_clear(), fsdbm_delete(), fsdbm_delete_if(), fsdbm_each_key(), fsdbm_each_pair(), fsdbm_each_value(), fsdbm_empty_p(), fsdbm_fetch(), fsdbm_has_key(), fsdbm_has_value(), fsdbm_invert(), fsdbm_key(), fsdbm_keys(), fsdbm_length(), fsdbm_select(), fsdbm_shift(), fsdbm_store(), fsdbm_to_a(), fsdbm_to_hash(), fsdbm_values(), gc_info_decode(), gc_stat_internal(), generate_json_object(), generic_ivar_remove(), getnext(), getnkey(), gvar_i(), hash2named_arg(), hash2ptr_dispparams(), iseq_compile_each(), ivar_i(), load_unlock(), obj_ivar_each(), oletypelib_path(), onig_st_insert_strend(), onig_st_lookup_strend(), ossl_call_client_cert_cb(), ossl_cipher_init(), ossl_cipher_initialize(), ossl_cipher_pkcs5_keyivgen(), ossl_pkcs12_initialize(), ossl_pkcs12_s_create(), ossl_pkcs7_decrypt(), ossl_pkcs7_s_sign(), ossl_sslctx_setup(), parse_exp(), r_fixup_compat(), r_object0(), rb_enc_aliases_enc_i(), rb_execarg_fixup(), rb_execarg_run_options(), rb_free_generic_ivar(), rb_gdbm_delete(), rb_gdbm_fetch2(), rb_gdbm_firstkey(), rb_gdbm_nextkey(), rb_get_kwargs(), rb_iseq_parameters(), rb_reserved_word(), rb_struct_each_pair(), reachable_object_from_i(), remove_method(), run_final(), set_state_ivars(), socklist_delete(), splpage(), sv_i(), tr_setup_table(), unknown_keyword_error(), unpack_entries(), update_char_offset(), and vm_stat().
const rb_data_type_t random_data_type [static] |
{
"random",
{
random_mark,
random_free,
random_memsize,
},
NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
}
Definition at line 331 of file random.c.
Referenced by get_rnd(), Init_Random(), random_alloc(), and try_get_rnd().
| VALUE rb_cRandom |
Definition at line 306 of file random.c.
Referenced by Init_Random(), rb_ary_sample(), rb_ary_shuffle_bang(), and try_get_rnd().
union { ... } sipseed [static] |
Referenced by Init_RandomSeed(), and rb_memhash().
1.6.1