diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-20 11:05:38 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-20 11:05:38 +0000 |
commit | ced9ad5ab546d7ae478066a13116015033e2b485 (patch) | |
tree | b07d39b3def6e9841b92079c7861b57bee324a6a /random.c | |
parent | cdde8c23de076db8c89795bf8a1bb4308d72d9c1 (diff) | |
download | ruby-ced9ad5ab546d7ae478066a13116015033e2b485.tar.gz |
* random.c (rand_init): Make it possible to specify arbitrary array
for init_genrand().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r-- | random.c | 6 |
1 files changed, 0 insertions, 6 deletions
@@ -377,18 +377,12 @@ rand_init(struct MT *mt, VALUE vseed) seed = rb_to_int(vseed); len = rb_absint_numwords(seed, 32, NULL); - if (MT_MAX_STATE < len) - len = MT_MAX_STATE; if (len > numberof(buf0)) buf = ALLOC_N(unsigned int, len); sign = rb_integer_pack(seed, buf, len, sizeof(uint32_t), 0, INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER); if (sign < 0) sign = -sign; - if (sign != 2) { /* not overflow */ - while (0 < len && buf[len-1] == 0) - len--; - } if (len == 0) { buf[0] = 0; len = 1; |