[ruby-cvs:78685] e2b192f7d5 (master): rand(beginless_range) raise Errno::EDOM instead of TypeError

"Kazuhiro NISHIYAMA" <[email protected]>
Newsgroups gmane.comp.lang.ruby.cvs
Message-ID <[email protected]>
Kazuhiro NISHIYAMA	2019-12-15 14:47:36 +0900 (Sun, 15 Dec 2019)

  New Revision: e2b192f7d5

  https://github.com/ruby/ruby/commit/e2b192f7d5

  Log:
    rand(beginless_range) raise Errno::EDOM instead of TypeError
    
    same as `rand(endless_range)`
    
    Before:
    ```
    $ ruby -e 'rand(..1)'
    Traceback (most recent call last):
    2: from -e:1:in `<main>'
    1: from -e:1:in `rand'
    -e:1:in `-': nil can't be coerced into Integer (TypeError)
    ```
    
    After:
    ```
    $ ruby -e 'rand(..1)'
    Traceback (most recent call last):
    1: from -e:1:in `<main>'
    -e:1:in `rand': Numerical argument out of domain (Errno::EDOM)
    ```

  Modified files:
    random.c
    test/ruby/test_rand.rb
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.