nobu
99aaee351e
* random.c (random_rand): get rid of overflow.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-20 03:04:59 +00:00
nobu
2f6c0e3be3
* array.c (rb_ary_shuffle_bang, rb_ary_sample): add optional
...
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-23 22:07:39 +00:00
nobu
5274f89201
* complex.c (nucomp_marshal_load): should check the argument.
...
[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
2010-08-05 09:36:16 +00:00
nobu
a4c0f7dfae
* random.c (Init_Random): add Random::DEFAULT.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-03 12:16:06 +00:00
akr
7f51312344
add an assertion message.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 11:28:23 +00:00
nobu
93bbd7869c
* random.c (random_rand): subtraction method of non-numeric can
...
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-26 03:08:07 +00:00
akr
9afaef347c
add a test.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-12 20:50:45 +00:00
nobu
f571492922
* random.c (rand_init): ignore higher bits if all they are same as
...
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-07 22:22:36 +00:00
nobu
6decf411c6
* random.c (random_rand): raise ArgumentError on nil, as the
...
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-04-03 01:51:26 +00:00
naruse
1bf3ca494f
* random.c (rb_reset_random_seed): set seed in this. [ruby-core:28655]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-15 03:26:29 +00:00
nobu
31875e97b4
* random.c (random_rand): fixed for edge cases of ranges.
...
[ruby-dev:39166]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-26 14:58:44 +00:00
nobu
9676023607
* random.c (random_rand): unified random_int and random_float.
...
[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-26 10:20:30 +00:00
nobu
a194550e5c
* random.c (rb_random_int): arguments have to be converted to
...
integer. [ruby-core:24679]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-02 15:32:04 +00:00
mame
dfd3d1fb29
* test/ruby/test_rand.rb: add tests for Random#float's rejection
...
against Infinity and NaN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-02 08:40:52 +00:00
nobu
e626e0bdec
* random.c (rand_int): prevent from GC.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-02 05:20:51 +00:00
mame
045136d475
* test/ruby/test_rand.rb: add tests for Random class.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-30 12:57:02 +00:00
nobu
2e4ad56fc2
* test/ruby/test_rand.rb (test_big_seed): tests also instance methods.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-21 23:38:23 +00:00
mame
4516f623b8
* random.c (rand_init): array length of random seed was broken, which
...
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-21 14:51:17 +00:00
nobu
eb9bc2d265
* random.c (rb_random_t): objectified. [EXPERIMENTAL]
...
[ruby-dev:30954]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16 06:00:35 +00:00
matz
6bbd76a732
* random.c (rb_f_rand): type check simplified. strings are no
...
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-29 13:29:12 +00:00
mame
7e6dd6142e
* test/ruby/test_rand.rb: add tests to achieve over 95% test coverage
...
of random.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-25 15:56:36 +00:00
akr
c47ca1f02f
add test_rand_0x100000000.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-02-07 16:11:14 +00:00
akr
943e67ef97
* random.c (init_by_array): imported from mt19937ar-cok.tgz.
...
(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
2005-01-04 17:38:39 +00:00