From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 95E231F463 for ; Wed, 25 Sep 2019 11:07:34 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A1A101209EE; Wed, 25 Sep 2019 20:07:25 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 1A2341209B7 for ; Wed, 25 Sep 2019 20:07:21 +0900 (JST) Received: by filter0105p3las1.sendgrid.net with SMTP id filter0105p3las1-27343-5D8B4A6D-37 2019-09-25 11:07:25.397500701 +0000 UTC m=+143156.003640511 Received: from herokuapp.com (unknown [184.73.122.220]) by ismtpd0043p1mdw1.sendgrid.net (SG) with ESMTP id tTImIMgJTQS4jjVzrZTB3w for ; Wed, 25 Sep 2019 11:07:25.254 +0000 (UTC) Date: Wed, 25 Sep 2019 11:07:25 +0000 (UTC) From: nigel@brookes-thomas.co.uk Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70636 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16180 X-Redmine-Issue-Author: BillyRuffian X-Redmine-Sender: BillyRuffian X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?ZHXzunFA=2FIsGeCz=2FZfEW=2Fkzj8ZKNVzZf15+D21tkFcGFOk+pZIxjRkz9G1eers?= =?us-ascii?Q?VXroEX8yjJXmDzRq31tqAUVy3qdJv=2FcnUFaAB6d?= =?us-ascii?Q?kgHORMnjsMhUMcVuJBWmdI+L5jCwe7DLkG21pp2?= =?us-ascii?Q?wHuSKcSMz8YN7qFNf1UC3vpEPtmGgJAx8bXZ8qK?= =?us-ascii?Q?njTfYRocodbZrtSghe1H72ic3roJGYJeFMA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95081 Subject: [ruby-core:95081] [Ruby master Bug#16180] Random.rand(max) ignores / is broken when max ceiling value is a float X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #16180 has been reported by BillyRuffian (Nigel Brookes-Thomas). ---------------------------------------- Bug #16180: Random.rand(max) ignores / is broken when max ceiling value is a float https://bugs.ruby-lang.org/issues/16180 * Author: BillyRuffian (Nigel Brookes-Thomas) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18] ruby 2.7.0preview1 (2019-05-31 trunk c55db6aa271df4a689dc8eb0039c929bf6ed43ff) [x86_64-darwin18] Calling `rand` with a float of > 1 always return 0. Calling `rand` with a float 0 < value > 1 will ignore the ceiling value. e.g. ``` rand(1.1) => 0 rand(1.1) => 0 rand(0.5) => 0.9501516156613756 rand(0.5) => 0.6864252478379304 ``` -- https://bugs.ruby-lang.org/