summaryrefslogtreecommitdiff
path: root/random.c
AgeCommit message (Collapse)Author
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
2009-11-03* random.c (rb_hash_start): moved from string.c.nobu
* random.c (Init_RandomSeed2): register global address before set. * random.c (Init_RandomSeed): initialize hashseed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03fix typos.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09* include/ruby/ruby.h (rb_data_type_struct): constified dsize.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-03* random.c (random_rand): fixed rdoc. [ruby-core:25332]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-27* random.c (random_rand): random integer can be a fixnum fornobu
bignum range. [ruby-dev:39173] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-26* random.c (random_rand): refined error message.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-26* random.c (random_rand): fixed for edge cases of ranges.nobu
[ruby-dev:39166] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-26* random.c (random_rand): unified random_int and random_float.nobu
[ruby-dev:39158]. and fixes [ruby-core:24655], [ruby-core:24677], [ruby-core:24679]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-25* random.c (rand_init, random_load): use already defined macro.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-02* random.c (rb_random_int): arguments have to be converted tonobu
integer. [ruby-core:24679] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-02* random.c (rand_int): prevent from GC.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-01* random.c (random_float): rejects Infinity and NaN.nobu
[ruby-core:24651] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-30* random.c (init_genrand): ensure invariant of mt->next and mt->left.mame
mt->next should always equal mt->state + N + 1 - mt->left. In fact, 'r = Random.new(0); r == r.dup' has returned false. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-30* random.c (random_bytes): use NUM2LONG instead of FIX2LONG becausemame
Random#bytes may receive bignum. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-22* random.c (random_{state,left}): internal/debug use.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-21* random.c (rand_init): array length of random seed was broken, whichmame
causes memory error with srand(2**1000000-1). * test/ruby/test_rand.c: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 * random.c: workaround for VC++ 6.0.usa
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18* random.c (rb_random_{int32,real,bytes,int}): added functions fornobu
extension libraries. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18* random.c (fill_random_seed): needs wincrypt.h.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18* random.c (fill_random_seed): use cryptographic service on Windows.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-17* random.c (DIGSPERINT): fix for LP64.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-17* random.c (fill_random_seed): /dev/urandom is not available onnobu
DOSISH systems. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-17* random.c (random_equal): new method Random#==.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-17* random.c (dump_mt): removed debug function.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16* random.c (fill_random_seed): suppress a warning.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16* random.c (rb_random_t): objectified. [EXPERIMENTAL]nobu
[ruby-dev:30954] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-11* random.c (rand_init): use fixed buffer for small numbers.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-10* random.c (limited_rand): expands to long before shift so thatnobu
the result does not overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-10* random.c (rand_init): got rid of buffer overflow.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-10* random.c (struct MT): ruby already assumes int has 32bit atnobu
least, so no needs to use long. * random.c (rand_init): git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-11* random.c (fill_random_seed): enclosed conditionally usednobu
variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22stripped trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-18* io.c (rb_write_error2, argf_next_argv), process.c (rb_fork_err),nobu
random.c (fill_random_seed): suppress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-04* random.c (rb_f_srand): update RDoc. [ruby-core:21113]matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-29* random.c (rb_f_rand): type check simplified. strings are nomatz
longer allowed for argument. [ruby-dev:37655] * test/ruby/test_rand.rb (TestRand::o.to_int): need override to_int. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-14* bignum.c (rb_big_mul): faster multiplication by Karatsuba method andmame
twice faster square than normal multiplication. * random.c (rb_rand_internal): used by Bignum#*. * test/ruby/test_bignum.rb: add some tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05* include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.matz
a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp> in [ruby-dev:36102]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-17* random.c (struct MT): packed Mersenne Twister staffs.nobu
* random.c (struct RandSeed): packed random seed staffs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-20* random.c (Init_RandomSeed2): should be void.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-20* string.c (rb_memhash): randomize hash to avoid algorithmicakr
complexity attacks. (rb_str_hash): use rb_memhash. * include/ruby/intern.h (rb_reset_random_seed): declared. * thread.c (rb_thread_atfork): call rb_reset_random_seed. * inits.c (rb_call_inits): call Init_RandomSeed at first. * random.c (seed_initialized): defined. (fill_random_seed): extracted from random_seed. (make_seed_value): extracted from random_seed. (rb_f_rand): initialize random seed at first. (initial_seed): defined. (Init_RandomSeed): defined. (Init_RandomSeed2): defined. (rb_reset_random_seed): defined. (Init_Random): call Init_RandomSeed2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08* array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,ko1
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c, io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c, string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c, vm.c, gc.c: allocated memory objects by xmalloc (ruby_xmalloc) should be freed by xfree (ruby_xfree). * ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c, ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c, ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c, ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c, ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e