nobu
a43852a3a4
* random.c (random_rand): add the result of random to the
...
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 11:19:30 +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
marcandre
7729de4d91
* array.c: Documentation: change => in call-seq to ->.
...
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-05-17 21:07:33 +00:00
nobu
5d8c8b46bb
* random.c (make_seed_value): fix leading-zero-guard condition on
...
bdigit is smaller than 32bit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-13 06:00:49 +00:00
akr
19afeacb88
* random.c (rand_init): use the absolute value of seed to
...
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-12 15:16: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
kazu
88a4bf912d
fix rdoc. see r26808
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-03 14:57:20 +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
46a4000a68
* random.c: change include order; ruby.h should be at first.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-29 00:21:20 +00:00
nobu
21c7d36573
* random.c (default_rand): removed initial buffer.
...
* 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 09:33:39 +00:00
nobu
d188e1a852
* random.c (next_state): no initialization here.
...
* 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 05:06:11 +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
akr
373ed885c6
fix rdoc.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-03 15:14:21 +00:00
akr
19b2909ee8
* random.c (fill_random_seed): don't use O_NOFOLLOW because
...
/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
2010-02-05 15:04:38 +00:00
nobu
f41eaf8431
* random.c (rb_hash_start): moved from string.c.
...
* 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-03 23:50:51 +00:00
akr
b9e0294eda
fix typos.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
nobu
b46cd0e400
* include/ruby/ruby.h (rb_data_type_struct): constified dsize.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 02:11:35 +00:00
nobu
299d8fb1b7
* random.c (random_rand): fixed rdoc. [ruby-core:25332]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-03 19:49:43 +00:00
nobu
9460fd0ee0
* random.c (random_rand): random integer can be a fixnum for
...
bignum range. [ruby-dev:39173]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-27 04:51:19 +00:00
nobu
2981448f33
* random.c (random_rand): refined error message.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-26 15:00:00 +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
ebbe19e1ad
* random.c (rand_init, random_load): use already defined macro.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-25 09:21:39 +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
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
nobu
51d1c5e73b
* random.c (random_float): rejects Infinity and NaN.
...
[ruby-core:24651]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-01 09:51:05 +00:00
mame
fe22f83ecf
* random.c (init_genrand): ensure invariant of mt->next and mt->left.
...
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 12:55:04 +00:00
mame
6937a3e26f
* random.c (random_bytes): use NUM2LONG instead of FIX2LONG because
...
Random#bytes may receive bignum.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-30 12:45:51 +00:00
nobu
f8faa5e8fe
* random.c (random_{state,left}): internal/debug use.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-22 23:52:20 +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
usa
4c7c46b6af
* random.c: workaround for VC++ 6.0.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 02:40:31 +00:00
nobu
f3d022543e
* random.c (rb_random_{int32,real,bytes,int}): added functions for
...
extension libraries.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 00:16:25 +00:00
nobu
8195282dfc
* random.c (fill_random_seed): needs wincrypt.h.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 00:10:46 +00:00
nobu
b12c5a85b4
* random.c (fill_random_seed): use cryptographic service on Windows.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 00:07:07 +00:00
nobu
003fa83e0c
* random.c (DIGSPERINT): fix for LP64.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-17 06:21:14 +00:00
nobu
ed52949e79
* random.c (fill_random_seed): /dev/urandom is not available on
...
DOSISH systems.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-17 04:58:38 +00:00
nobu
115c220b4d
* random.c (random_equal): new method Random#==.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-17 04:56:12 +00:00
nobu
bc0ea18dbd
* random.c (dump_mt): removed debug function.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-17 04:52:22 +00:00
nobu
3622071601
* random.c (fill_random_seed): suppress a warning.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-16 09:43:01 +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
nobu
17c1e45405
* random.c (rand_init): use fixed buffer for small numbers.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-11 17:24:46 +00:00
nobu
a88589c7d1
* random.c (limited_rand): expands to long before shift so that
...
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 17:37:52 +00:00
nobu
1dabc36b8f
* random.c (rand_init): got rid of buffer overflow.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-10 15:16:32 +00:00
nobu
234485dc7d
* random.c (struct MT): ruby already assumes int has 32bit at
...
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-07-10 05:44:08 +00:00
nobu
383b905f5e
* random.c (fill_random_seed): enclosed conditionally used
...
variables.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-11 20:14:51 +00:00
nobu
12d2c8ba41
stripped trailing spaces.
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
nobu
3229c32008
* io.c (rb_write_error2, argf_next_argv), process.c (rb_fork_err),
...
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-02-18 06:21:04 +00:00
matz
3c66767bda
* random.c (rb_f_srand): update RDoc. [ruby-core:21113]
...
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-04 23:00:39 +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
19f45f853c
* bignum.c (rb_big_mul): faster multiplication by Karatsuba method and
...
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-12-14 03:59:02 +00:00