aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_rand.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_rand.rb (TestRand#test_default_seed): addkosaki2015-11-301-0/+4
| | | | | | srand case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (Init_RandomSeed): move all Random::DEFAULTkosaki2015-11-301-0/+9
| | | | | | | | | | | | | construction bits to Init_RandomSeed2. Random::DEFAULT and Ruby internal hashes are no longer shared their seed. * random.c (Init_RandomSeed2): ditto. And, kill evil rb_obj_reveal() stuff. * random.c (init_hashseed): add MT argument. * random.c: (init_siphash): ditto. * test/ruby/test_rand.rb (TestRand#test_default_seed): new test for Random::DEFAULT::seed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/lib/envutil.rb: Moved from test/ruby/.akr2014-11-131-1/+0
| | | | | | | | | | | | | | * test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby: get rid of warnings.usa2014-03-051-2/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby: better assertionsnobu2013-12-131-5/+5
| | | | | | * test/ruby: use better assertions instead of mere assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44173 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rand_init): Make it possible to specify arbitrary arrayakr2013-11-201-1/+1
| | | | | | | | for init_genrand(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_rand.rb: fix r43224. local variable `e' isko12013-10-091-1/+1
| | | | | | | | no longer available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby: assert_raise_with_messagenobu2013-10-091-4/+2
| | | | | | * test/ruby: use assert_raise_with_message git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* call GC.start before fork-related tests to decrease GC cost on fork childrennaruse2013-07-111-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentErrorshugo2013-06-121-12/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when $SAFE is set to 4. $SAFE=4 is now obsolete. [ruby-core:55222] [Feature #8468] * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust): Kernel#untrusted?, untrust, and trust are now deprecated. Their behavior is same as tainted?, taint, and untaint, respectively. * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED() and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(), respectively. * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c, ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c, ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c, ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c, ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c, ext/socket/socket.c, ext/socket/udpsocket.c, ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c, ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c, load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c, safe.c, string.c, thread.c, transcode.c, variable.c, vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for $SAFE=4. * test/dl/test_dl2.rb, test/erb/test_erb.rb, test/readline/test_readline.rb, test/readline/test_readline_history.rb, test/ruby/test_alias.rb, test/ruby/test_array.rb, test/ruby/test_dir.rb, test/ruby/test_encoding.rb, test/ruby/test_env.rb, test/ruby/test_eval.rb, test/ruby/test_exception.rb, test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb, test/ruby/test_io.rb, test/ruby/test_method.rb, test/ruby/test_module.rb, test/ruby/test_object.rb, test/ruby/test_pack.rb, test/ruby/test_rand.rb, test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb, test/ruby/test_struct.rb, test/ruby/test_thread.rb, test/ruby/test_time.rb: remove tests for $SAFE=4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: increase limit for generic randnobu2013-02-241-0/+8
| | | | | | | | * random.c (rb_random_ulong_limited): limit is inclusive, but generic rand method should return a number less than it, so increase for the difference. [ruby-core:52779] [Bug #7935] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: fix error messagenobu2013-02-221-0/+15
| | | | | | | * random.c (rb_random_ulong_limited): fix error message for negative value. [ruby-dev:47061] [Bug #7903] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c, rational.c: make marshal methods privatenobu2012-12-031-5/+5
| | | | | | | | * random.c (Init_Random), rational.c (Init_Rational): make marshal methods private. [Feature #6539] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* array.c: use rb_random_ulong_limitednobu2012-10-091-2/+3
| | | | | | | | * array.c (rb_ary_sample): use rb_random_ulong_limited, since precision of long may be larger than double. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [Bug #6540]nobu2012-06-221-0/+8
| | | | | | | * test/ruby/test_rand.rb (TestRand#test_initialize_frozen): add missing test for [Bug #6540] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c: check initialize and loadnobu2012-06-221-0/+21
| | | | | | | * random.c (random_init, random_load): cannot initialize frozen object again, nor with tainted/untrusted object. [Bug #6540] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_s_rand): ensure default PRNG is re-initializednobu2012-03-111-2/+31
| | | | | | 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
* * test/ruby/test_rand.rb (test_random_bytes): fold mysteriouslynobu2011-06-301-2/+6
| | | | | | long line. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_s_rand, Init_Random): Random.rand should behave asmrkn2011-04-241-2/+16
| | | | | | | | | | 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
* * lib/test/unit.rb (assert_include): add alias.nobu2011-02-121-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_rand): get rid of overflow.nobu2010-11-201-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * array.c (rb_ary_shuffle_bang, rb_ary_sample): add optionalnobu2010-08-231-0/+1
| | | | | | | | | 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
* * complex.c (nucomp_marshal_load): should check the argument.nobu2010-08-051-0/+7
| | | | | | | | | [ruby-core:31622] * rational.c (nurat_marshal_load): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (Init_Random): add Random::DEFAULT.nobu2010-08-031-0/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add an assertion message.akr2010-06-051-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_rand): subtraction method of non-numeric cannobu2010-05-261-0/+3
| | | | | | | | 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
* add a test.akr2010-04-121-0/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rand_init): ignore higher bits if all they are same asnobu2010-04-071-0/+7
| | | | | | 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
* * random.c (random_rand): raise ArgumentError on nil, as thenobu2010-04-031-0/+1
| | | | | | | | | 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
* * random.c (rb_reset_random_seed): set seed in this. [ruby-core:28655]naruse2010-03-151-0/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_rand): fixed for edge cases of ranges.nobu2009-08-261-0/+8
| | | | | | | [ruby-dev:39166] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (random_rand): unified random_int and random_float.nobu2009-08-261-44/+50
| | | | | | | | [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
* * random.c (rb_random_int): arguments have to be converted tonobu2009-08-021-0/+1
| | | | | | | integer. [ruby-core:24679] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_rand.rb: add tests for Random#float's rejectionmame2009-08-021-0/+3
| | | | | | against Infinity and NaN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rand_int): prevent from GC.nobu2009-08-021-1/+12
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_rand.rb: add tests for Random class.mame2009-07-301-0/+190
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_rand.rb (test_big_seed): tests also instance methods.nobu2009-07-211-2/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rand_init): array length of random seed was broken, whichmame2009-07-211-0/+5
| | | | | | | | | 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
* * random.c (rb_random_t): objectified. [EXPERIMENTAL]nobu2009-07-161-80/+80
| | | | | | | [ruby-dev:30954] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (rb_f_rand): type check simplified. strings are nomatz2008-12-291-1/+1
| | | | | | | | | 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
* * test/ruby/test_rand.rb: add tests to achieve over 95% test coveragemame2008-03-251-0/+36
| | | | | | | of random.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* add test_rand_0x100000000.akr2005-02-071-0/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * random.c (init_by_array): imported from mt19937ar-cok.tgz.akr2005-01-041-0/+124
(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: svn+ssh://ci.ruby-lang.org/ruby/trunk@7723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e