summaryrefslogtreecommitdiffstats
path: root/random.c
Commit message (Collapse)AuthorAgeFilesLines
* * numeric.c (fix_to_s): avoid rb_scan_args() when no argumentmatz2008-03-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | given. * bignum.c (rb_big_to_s): ditto. * enum.c (enum_first): ditto. * eval_jump.c (rb_f_catch): ditto. * io.c (rb_obj_display): ditto. * class.c (rb_obj_singleton_methods): ditto. * object.c (rb_class_initialize): ditto. * random.c (rb_f_srand): ditto. * range.c (range_step): ditto. * re.c (rb_reg_s_last_match): ditto. * string.c (rb_str_to_i): ditto. * string.c (rb_str_each_line): ditto. * string.c (rb_str_chomp_bang): ditto. * string.c (rb_str_sum): ditto. * string.c (str_modifiable): declare inline. * string.c (str_independent): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (limited_big_rand): fix buffer overflow when SIZEOF_BDIGITSakr2008-02-021-6/+10
| | | | | | | is 2. fixed by Kenta Murata. [ruby-dev:33565] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * $Date$ keyword removed to avoid inclusion of locale dependentakr2008-01-061-1/+0
| | | | | | | string. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/intern.h, random.c, array.c:akr2007-12-241-2/+14
| | | | | | | | | | change exported name. genrand_int32 -> rb_genrand_int32. genrand_real -> rb_genrand_real. [ruby-core:14335] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14588 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: introduce 2 macros:ko12007-11-131-7/+7
| | | | | | | | | | | | | | | RFLOAT_VALUE(v), DOUBLE2NUM(dbl). Rename RFloat#value -> RFloat#double_value. Do not touch RFloat#double_value directly. * bignum.c, insns.def, marshal.c, math.c, numeric.c, object.c, pack.c, parse.y, process.c, random.c, sprintf.c, string.c, time.c: apply above changes. * ext/dl/mkcallback.rb, ext/json/ext/generator/generator.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c: update MT URL.[ruby-core:13305].matz2007-11-081-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h (struct RBignum): embed digits in RBignum forakr2007-09-011-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | small bignums. * bignum.c: RBignum embeded digits implemented. * include/ruby/intern.h: declare rb_big_resize. * gc.c: don't free embedded digits. * numeric.c: replace direct bignum field accessor by abstract field accessor such as RBIGNUM(val)->sign to RBIGNUM_SIGN(val). * sprintf.c: ditto. * compar.c: ditto. * marshal.c: ditto. * random.c: ditto. * .gdbinit: support embedded small bignums. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * encoding.c: provide basic features for M17N.matz2007-08-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * parse.y: encoding aware parsing. * parse.y (pragma_encoding): encoding specification pragma. * parse.y (rb_intern3): encoding specified symbols. * string.c (rb_str_length): length based on characters. for older behavior, bytesize method added. * string.c (rb_str_index_m): index based on characters. rindex as well. * string.c (succ_char): encoding aware succeeding string. * string.c (rb_str_reverse): reverse based on characters. * string.c (rb_str_inspect): encoding aware string description. * string.c (rb_str_upcase_bang): encoding aware case conversion. downcase, capitalize, swapcase as well. * string.c (rb_str_tr_bang): tr based on characters. delete, squeeze, tr_s, count as well. * string.c (rb_str_split_m): split based on characters. * string.c (rb_str_each_line): encoding aware each_line. * string.c (rb_str_each_char): added. iteration based on characters. * string.c (rb_str_strip_bang): encoding aware whitespace stripping. lstrip, rstrip as well. * string.c (rb_str_justify): encoding aware justifying (ljust, rjust, center). * string.c (str_encoding): get encoding attribute from a string. * re.c (rb_reg_initialize): encoding aware regular expression * sprintf.c (rb_str_format): formatting (i.e. length count) based on characters. * io.c (rb_io_getc): getc to return one-character string. for older behavior, getbyte method added. * ext/stringio/stringio.c (strio_getc): ditto. * io.c (rb_io_ungetc): allow pushing arbitrary string at the current reading point. * ext/stringio/stringio.c (strio_ungetc): ditto. * ext/strscan/strscan.c: encoding support. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby: moved public headers.nobu2007-06-101-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rb_f_rand): RDoc typo fix. a patch from Frederickmatz2006-09-241-1/+1
| | | | | | | Cheung <fred at 82ask.com>. [ruby-talk:216047] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_shuffle_bang): new method.matz2006-08-311-7/+3
| | | | | | | | | | | | | | * array.c (rb_ary_shuffle): ditto. * random.c (genrand_real): ditto. * random.c (genrand_int32): export the function. * random.c (Init_Random): initialize random seed at the beginning. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@10808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c: moved to ANSI function style from K&R function style.ocean2005-09-121-16/+8
| | | | | | | | | | | | | | | | | (used protoize on windows, so still K&R remains on #ifdef part of other platforms. And `foo _((boo))' stuff is still there) [ruby-dev:26975] * bignum.c, class.c, compar.c, dir.c, dln.c, dmyext.c, enum.c, enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c, main.c, marshal.c, math.c, numeric.c, object.c, pack.c, prec.c, process.c, random.c, range.c, re.c, regcomp.c, regenc.c, regerror.c, regexec.c, regparse.c, regparse.h, ruby.c, signal.c, sprintf.c, st.c, string.c, struct.c, time.c, util.h, variable.c, version.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rand_init): suppress warning.nobu2005-02-121-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rand_init): use ALLOC_N instead of ALLOCA_Nakr2005-01-071-2/+2
| | | | | | | by TAMURA Takashi. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_seed): O_NONBLOCK isn't defined on someocean2005-01-061-1/+4
| | | | | | | platforms. [ruby-dev:25417] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (limited_big_rand): didn't work if SIZEOF_BDIGITS == 2.akr2005-01-051-15/+19
| | | | | | | | | [ruby-dev:25408] * random.c (random_seed): refined. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (init_by_array): imported from mt19937ar-cok.tgz.akr2005-01-041-37/+216
| | | | | | | | | | | | | | | (genrand_int32): ditto. (genrand_real): replaced with genrand_res53 in mt19937ar-cok. (rand_init): support bignum for longer seed. (random_seed): generate longer seed. (make_mask): new function. (limited_rand): ditto. (limited_big_rand): ditto. (rb_f_rand): call limited_rand and limited_big_rand. [ruby-dev:25403] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_seed): don't use /dev/urandom if it is not character device.akr2005-01-031-3/+15
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_seed): use /dev/urandom if available.akr2005-01-031-1/+19
| | | | | | | [ruby-dev:25392] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval.c (rb_yield_0): should not re-submit TAG_BREAK if thismatz2004-03-151-1/+1
| | | | | | | yield is not break destination. [ruby-dev:23197] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5952 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* RDoc Struct and randomdave2003-12-281-0/+34
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * bignum.c (BIGZEROP): macro to determine if x is a bignum zero.matz2003-04-091-5/+0
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rb_f_rand): normalize bignum argument.matz2003-04-081-0/+5
| | | | | | | | * sprintf.c (rb_f_sprintf): was decrementing width even if there is no sign character. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rb_f_rand): type fix.eban2003-01-311-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * parse.y (yylex): remove EXPR_CMDARG according to the RHG book.matz2003-01-311-0/+5
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Updated Copyrights of Matz to 2003.michal2003-01-161-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move struct timeval to missing.hmichal2002-09-171-10/+0
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* *.c: Int vs Long cleanupmichal2002-08-211-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * hash.c (rb_hash_replace): should copy ifnone.matz2002-08-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * hash.c (rb_hash_dup): should preserve HASH_PROC_DEFAULT and HASH_DELETED flags. * hash.c (rb_hash_shift): shift from empty hash should not return its default proc. * hash.c (rb_hash_default_proc): new method. [new] * array.c (rb_ary_aref): no need for Bignum check. * array.c (rb_ary_aset): explicit Bignum check removd. * numeric.c (fix_aref): normalize bignum before bit-op. * bignum.c (rb_big_rand): max may be Bignum zero. * bignum.c (rb_cstr_to_inum): should normalize bignums, to avoid returning fixable bignum value. * bignum.c (rb_uint2big): there should be no zero sized bignum. * ext/extmk.rb.in: extmake() that works properly for both tkutil (tk/tkutil.so) and digest/sha1. * hash.c (rb_hash_equal): should check HASH_PROC_DEFAULT too. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (N, M): undef for <winnt.h> on MinGW.eban2002-07-261-0/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c: replace with Mersenne Twister RNG.matz2002-07-261-80/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eval.c (jump_tag_but_local_jump): preserve retval in LocalJumpError exceptions. * parse.y (command): no more check for "super outside of method". * eval.c (rb_mod_define_method): should set last_class and last_func in the block->frame. * eval.c (error_handle): should handle TAG_THROW as well. * parse.y (yylex): new decimal notation '0d4567'. * parse.y (yylex): new octal notation '0o777'. * parse.y (string_content): every string_content node should return string only. use NODE_EVSTR to coercing. * eval.c (rb_eval): NODE_EVSTR support. * re.c (rb_reg_quote): avoid unnecessary string allocation. * string.c (get_pat): quote metachracters before compiling a string into a regex. * string.c (rb_str_split_m): special treatment of strings of size 1, but AWK emulation. now uses get_pat(). * string.c (rb_str_match_m): quote metacharacters. * string.c (rb_str_match2): ditto. * ext/socket/socket.c (sock_addrinfo): make all 3 versions of getaddrinfo happy. [ruby-core:00184] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * various files: macro fix-up by Michal Rokos.matz2002-04-251-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * re.c (rb_reg_expr_str): should treat backslash specially inmatz2002-04-181-6/+6
| | | | | | | | | | | | | | | | | escaping. * io.c: complete off_t handling; missing argument for fptr_finalize(); polished rb_scan_args call. * dir.c: wrap multi-statment macro by do { } while (0) * eval.c, numeric,c, sprintf.c, util.c: ditto. * bignum.c (rb_big_eq): check `y == x' if y is neither Fixnum, Bignum, nor Float. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rand_init): add check for initstate(3).eban2002-04-111-1/+1
| | | | | | | * configure.in: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * io.c (READ_DATA_PENDING): uClibc support.eban2002-02-271-1/+1
| | | | | | | | * random.c (rand_init): ditto. * ext/socket/{addinfo.h,getaddrinfo.c} (gai_strerror): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * dir.c (dir_s_glob): supprt backslash escape of metacharactersmatz2001-02-141-1/+1
| | | | | | | | | | | | | | | | | | | and delimiters. * dir.c (remove_backslases): remove backslashes from path before calling stat(2). * dir.c (dir_s_glob): call rb_yield directly (via push_pattern) if block is given to the method. * dir.c (push_pattern): do not call rb_ary_push; yield directly. * eval.c (blk_copy_prev): reduced ALLOC_N too much. * eval.c (frame_dup): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* matzmatz2000-11-141-0/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* matzmatz2000-11-021-1/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* matz - nakada win32 patchmatz2000-08-031-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* matzmatz2000-07-041-4/+13
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 2000-05-01matz2000-05-011-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 2000-02-08matz2000-02-081-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 2000-01-17matz2000-01-171-5/+3
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 2000-01-08matz2000-01-081-15/+33
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@601 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 20000105matz2000-01-051-1/+1
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 19991206matz1999-12-061-6/+5
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* unsigned seedmatz1999-10-271-6/+6
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 1.4.1matz1999-09-161-1/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* regexp literal (e.g. \202) match, etc.matz1999-09-011-1/+4
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* 1.4.0matz1999-08-131-2/+2
| | | | git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e