[#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:18061] Re: New array methods cycle, choice, shuffle (plus bug in cycle)

From: "Gregory Brown" <gregory.t.brown@...>
Date: 2008-08-01 18:09:01 UTC
List: ruby-core #18061
On Fri, Aug 1, 2008 at 2:01 PM, Jim Weirich <jim.weirich@gmail.com> wrote:
> On Aug 1, 2008, at 1:53 PM, Thomas Enebo wrote:
>>
>> I would assume a randomized array based on name.  Picking a good name is
>> tough.  Picking a better name is not so easy.  Array.give_me_something
>
>
> What about:
>
>     array.random_choice

This would be a suitable analogy to Python's random.choice(array) ...
but is almost as long and only slightly more readable than:

array[rand(array.length)]

(as Thomas suggested).

I like the idea of Array#sample with an option argument to specify how
many random elements you want.
Would arr.sample(3) mean 'pick 3 elements from arr at random' or would
it mean 'randomly pick an element from arr 3 times, then give the
results'.
I think the former could be pretty useful.

But maybe this feature just isn't necessary.

-greg

In This Thread