# Ruby 1.9.1 - Array.new.choice missing?

**URL:** <https://www.ruby-forum.com/t/ruby-1-9-1-array-new-choice-missing/152402>\
**Category:** Ruby\
**Created:** [November 3, 2008, 4:17pm UTC](https://www.ruby-forum.com/t/ruby-1-9-1-array-new-choice-missing/152402 "2008-11-03T16:17:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bor\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/0ea827/32.png) [@bor\_S](https://www.ruby-forum.com/u/bor_S)\
**Post date:** [November 3, 2008, 4:17pm UTC](https://www.ruby-forum.com/t/ruby-1-9-1-array-new-choice-missing/152402/1 "2008-11-03T16:17:48Z")

</div>

Just wondering if I missed something. Ruby 1.9.1 doesn’t seem to have  
.choice anymore as a way to select a random element from an array. Has  
this been replaced by another functionname, or should I just use  
rand(Array.size)?

---

<div class="post-metadata">

**Author:** ![bor\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/0ea827/32.png) [@bor\_S](https://www.ruby-forum.com/u/bor_S)\
**Post date:** [November 3, 2008, 4:36pm UTC](https://www.ruby-forum.com/t/ruby-1-9-1-array-new-choice-missing/152402/2 "2008-11-03T16:36:07Z")

</div>

Hi,

In message “Re: Ruby 1.9.1 - Array.new.choice missing?”  
on Tue, 4 Nov 2008 00:16:22 +0900, Boris S.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|Just wondering if I missed something. Ruby 1.9.1 doesn’t seem to have  
|.choice anymore as a way to select a random element from an array. Has  
|this been replaced by another functionname, or should I just use  
|rand(Array.size)?

It’s renamed to #sample.

```
          matz.

```
