[#18121] [Ruby 1.8.7 - Bug #405] (Open) ssl.rb:31: [BUG] Bus Error — Anonymous <redmine@...>

Issue #405 has been reported by Anonymous.

14 messages 2008/08/04

[#18130] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — Brian Candler <B.Candler@...>

> Seriously though... Array.first is a noun.

10 messages 2008/08/05

[#18319] NEW Command: absolute_path() -- — "C.E. Thornton" <admin@...>

Core,

14 messages 2008/08/16
[#18321] Re: NEW Command: absolute_path() -- — Yukihiro Matsumoto <matz@...> 2008/08/18

Hi,

[#18381] [Bug #496] DRb.start_service(nil) is very slow — Hongli Lai <redmine@...>

Bug #496: DRb.start_service(nil) is very slow

11 messages 2008/08/25

[ruby-core:18164] Re: New array methods cycle, choice, shuffle (plus bug in cycle)

From: gdefty@...
Date: 2008-08-07 09:35:28 UTC
List: ruby-core #18164
In message "Re: [ruby-core:18133] Re: New array
methods cycle, choice, shuffle (plus bug in cycle)"

On Thu, August 07, 2008, 14:48:00 Yukihiro
Matsumoto wrote:

|    on Tue, 5 Aug 2008 23:37:57 +0900, "Martin
DeMello" <martindemello@gmail.com> writes:
|
||The second point looks wrong to me - I'd expect
sample! to remove a
||random set of elements from the array without
disturbing the ordering
||of the remaining elements.

|Then what your expectation works for?  I cannot
think of a situation
|where the difference means much.  Is there any
use-case for it?

I have the same expectation of the order being
preserved. It is not because I have any particular
reason to preserve it, but simply because that is
how I would expect a reasonable implementation to
work.

The problem with the shuffle-and-shift solutions
is that they do not scale well with the size of
the array. It is fine for small amounts of data
(e.g. the rock-paper-scissors example) but not how
I would expect a built-in method to be coded,
where the size of the array can not be known in
advance.

If I take a sample of one or two elements out of
an array of thousands of items, I would expect to
generate one or two random numbers, not thousands.
(And the next time a sample is taken, generate
thousands more, because more items may have been
added to the array since the last sample).

It is in such a case that the difference becomes
evident.

Regards,

graeme


In This Thread

Prev Next