summaryrefslogtreecommitdiff
path: root/random.c
AgeCommit message (Collapse)Author
2012-06-05obj_init_copynobu
* object.c (rb_obj_init_copy): should check if trusted too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-19 * random.c (random_init): Clarify that the default seed isdrbrain
Random.new_seed, not zero. Based on patch by Roger Pack. [ruby-trunk - Bug #6313] * random.c (rb_f_srand): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-14* include/ruby/intern.h: Add rb_check_arity, rb_error_arity [#6085]marcandre
* array.c: Use rb_check_arity / rb_error_arity * class.c: ditto * enumerator.c: ditto * eval.c: ditto * file.c: ditto * hash.c: ditto * numeric.c: ditto * proc.c: ditto * process.c: ditto * random.c: ditto * re.c: ditto * signal.c: ditto * string.c: ditto * struct.c: ditto * transcode.c: ditto * vm_eval.c: ditto * vm_insnhelper.c: ditto & implementation of rb_error_arity * test/ruby/test_arity.rb: tests for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-11* random.c (Init_Random): removed rb_Random_DEFAULT and register asnobu
mark-object instead of global variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-11* random.c (random_s_rand): ensure default PRNG is re-initializednobu
after fork. patched by Eric Wong. [ruby-core:41209][Bug #5661] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-18* random.c: remove a duplicated comment.mrkn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29* process.c (ruby_setsid): use rb_cloexec_open.akr
(rb_daemon): ditto. * ruby.c (load_file_internal): ditto. * file.c (rb_file_s_truncate): ditto. (file_load_ok): ditto. * random.c (fill_random_seed): ditto. * ext/pty/pty.c (chfunc): ditto. (get_device_once): ditto. * ext/io/console/console.c (console_dev): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-22* include/ruby/intern.h (rb_fd_set_cloexec): declared.akr
* io.c (rb_fd_set_cloexec): new function. (ruby_dup): call rb_fd_set_cloexec to set close-on-exec flag. (rb_sysopen_internal): ditto. (rb_pipe): ditto. (io_reopen): ditto. (io_cntl): ditto. * process.c (rb_f_exec): change the default :close_others option to true. (rb_f_system): ditto. (move_fds_to_avoid_crash): call rb_fd_set_cloexec to set close-on-exec flag. (ruby_setsid): ditto. (rb_daemon): ditto. * thread_pthread.c (rb_thread_create_timer_thread): call rb_fd_set_cloexec to set close-on-exec flag. * ruby.c (load_file_internal): ditto. * file.c (rb_file_s_truncate): ditto. (file_load_ok): ditto. * random.c (fill_random_seed): ditto. * ext/pty/pty.c (chfunc): ditto. (get_device_once): ditto. * ext/openssl/ossl_bio.c (ossl_obj2bio): ditto. * ext/socket/init.c (rsock_socket): ditto. (rsock_s_accept_nonblock): ditto. (rsock_s_accept): ditto. * ext/socket/socket.c (rsock_sock_s_socketpair): ditto. * ext/socket/ancdata.c (discard_cmsg): ditto. (make_io_for_unix_rights): ditto. * ext/socket/unixsocket.c (unix_recv_io): ditto. * ext/io/console/console.c (console_dev): ditto. [ruby-core:38140] [Feature #5041] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-05* random.c: Improve documentation of Random. Patch by Gregorydrbrain
Parkhurst. [Ruby 1.9 - Bug #5410] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-04* random.c (Init_Random): Add a top-level comment for Random. Patchdrbrain
by Brett Bim. [Ruby 1.9 - Bug #5403] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29* use RB_TYPE_P which is optimized for constant types, instead ofnobu
comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-20* include/ruby/intern.h (rb_update_max_fd): declaration moved fromakr
internal.h. * file.c: ditto. * io.c: call rb_update_max_fd for each new fds. * process.c: ditto. * random.c: ditto. * ruby.c: ditto. * ext/io/console/console.c: ditto. * ext/openssl/ossl_bio.c: ditto. * ext/pty/pty.c: ditto. * ext/socket/init.c: ditto. * ext/socket/socket.c: ditto. * ext/socket/ancdata.c: ditto. * ext/socket/unixsocket.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-27* random.c: Documentation fix for Random#bytesmarcandre
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-15* remove trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-25* random.c (random_rand): remove unused variables.naruse
* struct.c (rb_struct_define_without_accessor): ditto. * strftime.c (rb_strftime_with_timespec): ditto. * sprintf.c: ditto. * time.c (time_asctime): remove useless GetTimeval(). * thread_pthread.c: cast to (void *) for %p. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-24* random.c (rb_f_rand, random_s_rand): RDocs for them.sorah
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-24* random.c (random_s_rand, Init_Random): Random.rand should behave asmrkn
Random::DEFAULT.rand rather than Kernel#rand. * random.c (rand_range, random_rand): rand_range function extracted from random_rand function. * random.c (rb_f_rand): accept a Range argument as Random#rand [ruby-dev:43427] #4605 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-20* random.c (rb_f_srand): fix rdoc: srand(0)'s 0 is a seed.naruse
[ruby-core:35833] fixes #4590 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05* random.c (random_rand): suppress a warning.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-25* random.c: parenthesize macro arguments.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-20* random.c (random_rand): get rid of overflow.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-04* random.c (rand_init): This checks the value is in 32bit or not,naruse
so use int32_t, not int. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-04* random.c (rand_init): remove useless assignment.naruse
* re.c (update_char_offset): remove unused variable. * re.c (read_escaped_byte): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-10* random.c (rb_genrand_ulong_limited): renamed fromnaruse
rb_rand_internal and now this is public API. * include/ruby/ruby.h (rb_genrand_ulong_limited): added. * bignum.c (big_sparse_p): use rb_genrand_ulong_limited. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-26* random.c (rb_random_int32): suppress warning on LP64 platforms.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-25* array.c (rb_ary_{shuffle_bang,sample}): use Random class object.nobu
* random.c (try_get_rnd): use default_rand for Random as same as singleton methods. * random.c (rb_random_real): check the range of result. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-25reverted to r29091; r29092 breaks test-allshyouhei
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-25* random.c (rb_random_int32): fixed typo.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-25* random.c (rb_random_real): check the range of result.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-25* array.c (rb_ary_{shuffle_bang,sample}): use Random class object.nobu
* random.c (try_get_rnd): use default_rand for Random as same as singleton methods. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-23* array.c (rb_ary_shuffle_bang, rb_ary_sample): add optionalnobu
argument random. [ruby-dev:41923] [EXPERIMENTAL] * random.c (rb_random_{int32,real,bytes}): fallback to normal method invocation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-03* random.c (Init_Random): add Random::DEFAULT.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-27* class.c, compile.c, dir.c, file.c, iseq.c, parse.y, random.c:naruse
clean unused-value warnings. * cont.c, process.c, vm_exec.h: clean cast warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-19* random.c (DEFAULT_SEED_LEN): suppress a warning.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18* include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]nobu
add parent member. * error.c (rb_typeddata_inherited_p): new function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-13* process.c (rb_fork_err): suppress gcc 4.4 warnings.nobu
* random.c (fill_random_seed): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-26* random.c (random_rand): add the result of random to thenobu
beginning of range, not the opposite. [ruby-dev:41415] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-26* random.c (random_rand): subtraction method of non-numeric cannobu
return Float, and add the result of random to the beginning of range, not the opposite. [ruby-dev:41410] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17* array.c: Documentation: change => in call-seq to ->.marcandre
Harmonize "#=>" in examples. [ruby-core:30206] * bignum.c: ditto * class.c: ditto * compar.c: ditto * cont.c: ditto * dir.c: ditto * encoding.c: ditto * enum.c: ditto * enumerator.c: ditto * error.c: ditto * eval.c: ditto * file.c: ditto * gc.c: ditto * io.c: ditto * load.c: ditto * marshal.c: ditto * math.c: ditto * numeric.c: ditto * object.c: ditto * pack.c: ditto * proc.c: ditto * process.c: ditto * random.c: ditto * range.c: ditto * re.c: ditto * ruby.c: ditto * signal.c: ditto * sprintf.c: ditto * string.c: ditto * struct.c: ditto * thread.c: ditto * time.c: ditto * transcode.c: ditto * variable.c: ditto * vm_eval.c: ditto * vm_method.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-13* random.c (make_seed_value): fix leading-zero-guard condition onnobu
bdigit is smaller than 32bit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-12* random.c (rand_init): use the absolute value of seed toakr
make srand(-2**40) portable with 32bit and 64bit. [ruby-core:29292](2) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-07* random.c (rand_init): ignore higher bits if all they are same asnobu
the lower sign bit. [ruby-core:29292](2) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-03fix rdoc. see r26808kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-03* random.c (random_rand): raise ArgumentError on nil, as thenobu
documentation implies. [ruby-core:29075] * random.c (rb_f_rand): mentioned the case of when max is nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-29* random.c: change include order; ruby.h should be at first.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-15* random.c (default_rand): removed initial buffer.nobu
* random.c (Init_RandomSeed): initialize seed of default random. * random.c (Init_RandomSeed2): turn the seed to Bignum object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-15* random.c (next_state): no initialization here.nobu
* random.c (default_mt): always return initialized MT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-15* random.c (rb_reset_random_seed): set seed in this. [ruby-core:28655]naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-03fix rdoc.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-05* random.c (fill_random_seed): don't use O_NOFOLLOW becauseakr
/dev/urandom is a symlink in OpenSolaris. * lib/securerandom.rb (SecureRandom.random_bytes: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e