Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118817 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 90709 invoked from network); 15 Oct 2022 09:19:49 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Oct 2022 09:19:49 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C9169180054 for ; Sat, 15 Oct 2022 02:19:47 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 15 Oct 2022 02:19:47 -0700 (PDT) Received: by mail-ej1-f44.google.com with SMTP id sc25so15038099ejc.12 for ; Sat, 15 Oct 2022 02:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wcflabs.de; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=SyZnh6u/zlr80iUhGjdDTGw+weWQQvWbwMt/O0UM9FU=; b=iViZlupXGCIV5by/3xG1PDcjVThgGjppzbBzjERw3ouNMr96v4Guvx/hUL4aRE939e O4UymoxhYbG0QyxviH8If0wKup0U4nr/mHUpX9FqBSD8o/+Id8X0e+1vJ16ouZzd8XAf 71A7HvU0oF2L0lPrq0OHaXJieATY2pwc7h6K98LiHJYCq+XCIRXETbIoe+ewv1vcJDWh DxDK5MgaxdezP040M4edLN3LqLSSYxhL473Agr27ThC+RUIWNd2EZHFPJTKZ2hAtU/X/ dc1pMVOzflDWrjLFqm5hZF6eMmNY7FeAlEw5CjukfyotdEjyVeS8cibcL7WnDNpXI5yH hddA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SyZnh6u/zlr80iUhGjdDTGw+weWQQvWbwMt/O0UM9FU=; b=Z8qZs5cyX05qhs3Ms14CxhN4yjLwLmmPGMJ++LKP87ZmhdTY6W4G+HrQpFnQVVaA9Q UndteTI1pfbCVTPR8Tl9uWD1CgMWdIFDz2oz/zovQwxp4TME1JPEPnfexADZ+B7kVLL2 ZLkgBYums28LHYM1mAydi/YAH8hy9Ck8YAbMUPNC526KDvjqvSuVcwLo8J5KZMDZBQ8P T2FZ0kMe16hDL6hiZ4KwzX6BLbbdOYzfppXk5SyZoxkIa8RlTO5qmUFF5zJkDE7D++c9 7PElv9OTxxAowacXkXjggmXfy/1ZfQeKlnOwHaVkv+XNiNFLOT5IQ5SEwiYxOUHVdDdd JtKg== X-Gm-Message-State: ACrzQf1uAE1iCrLp9GXhEGfto5gsih8iKsWL4zLzR9FxMPsc/HlwYa1/ 9ZeQ7iAiV4rBARMfuwwRkvMZbGH8FMLP/A== X-Google-Smtp-Source: AMsMyM7H9Nt6nvLb3mBrjAvmUwXGVRP2BdcYpPJpZZHy5e/ZP7n4qBXm+DftaOfa7kUCjbeq7lHvPQ== X-Received: by 2002:a17:907:96a3:b0:790:65a:3a0a with SMTP id hd35-20020a17090796a300b00790065a3a0amr552512ejc.728.1665825585220; Sat, 15 Oct 2022 02:19:45 -0700 (PDT) Received: from ?IPV6:2a02:908:d12:2d80:b4fa:913a:8a3b:a748? ([2a02:908:d12:2d80:b4fa:913a:8a3b:a748]) by smtp.gmail.com with ESMTPSA id kx22-20020a170907775600b00738795e7d9bsm2896650ejc.2.2022.10.15.02.19.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 15 Oct 2022 02:19:44 -0700 (PDT) Message-ID: <196dba6f-7800-134b-fbaa-9e1cbcf5bd85@wcflabs.de> Date: Sat, 15 Oct 2022 11:19:43 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Content-Language: de-DE To: =?UTF-8?Q?Alexandru_P=c4=83tr=c4=83nescu?= Cc: PHP internals , tim@bastelstu.be References: <5ceebae4-a3fb-5d29-cdb7-dceed7b07c78@wcflabs.de> Reply-To: =?UTF-8?Q?Joshua_R=c3=bcsweg?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] RFC [Discussion]: Randomizer Additions From: internals@lists.php.net ("Joshua Rüsweg via internals") Hi > For completeness, it would be good to have nextBool() as well. I'm just wondering if that's really necessary. Generating a boolean is trivial with the nextFloat method (see example 1. Simulate a coinflip from the RFC). > No, IMO. Mathematically it doesn't really make sense and talking about > floats, it will also be a very corner case not reached in tests that > might happen in production rarely and break things. Why does it not make mathematical sense? With the nextFloat method, I can understand the argument, because that is otherwise opaque, especially when you work with probabilities. With the getFloat method, however, I can imagine a few cases in which this makes sense. In our example, for example, we calculate a random longitude and latitude with the method. However, the value of Lat: +90.0 Lng: +180.0 cannot be generated, although it is a valid value. However, the value of Lat: -90.0 Lng: -180.0 is included. Am I missing something, or is there currently no simple mathematical way to implement this with an open-right interval? > I am having another small issue. > As the Randomizer class is final, I guess this will not be perfectly > polyfillable in userland. > So... , if accepted, would it be completely wrong to have these new > methods in PHP 8.2? What can it break? I am relatively new and have little to no experience with contributing PHP functions, but I don't think this should be done. There is a good reason why this is not done and it only causes confusion if any functions are introduced after the feature freeze. In the end, however, I think it is the release manager who decides. Cheers Joshua Rüsweg