Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119189 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 29931 invoked from network); 20 Dec 2022 08:07:38 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Dec 2022 08:07:38 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D2BC8180089 for ; Tue, 20 Dec 2022 00:07:36 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,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-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) (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 ; Tue, 20 Dec 2022 00:07:33 -0800 (PST) Received: by mail-yb1-f170.google.com with SMTP id t15so32854ybq.4 for ; Tue, 20 Dec 2022 00:07:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=yiKpFrC8YwH7R0BdHZ2o0bBTK6gxY4LNi3omKGgleKM=; b=QDGHHDYo5HU+J73r43idNvwi+kLZygVdL/8rgh/L/CaaCRbIdVYD8sl3J+PItDLss6 fD/UQeKGWPKe2O0f8bwyM3GwVKmKwue6StuJyZP3oUlUuftBV+PUcIPxU6FaLPEOBG/k 41IrllVBbT5MXH7UYcyRQGqjnN2b+Snd0cZoUtw9qLqAw4uEVU6Vw8d6m+H8ZoCXTbDV 1RNZWBQICDe3JaxDq1GB6XtNOqq46g+/DzEEaHsBgPOe0/RQ57pIVKsdj4oml74rF2Ty U5x9G6vO3FzGQl3pfDWq5e60FaDPCeCzGweNuB9WiMwsF/R9wYN3BPYgj0k3sn/32zYc Neig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yiKpFrC8YwH7R0BdHZ2o0bBTK6gxY4LNi3omKGgleKM=; b=3rfJBbxB0bCU5ne3CXmnBlmwCZzXjQMup22T9VLNqK+3c8HfpA23T2v1D8rB0/WcY5 dZU6RpWcZAD54S3BIS/subDbdP9QuhpZ+rWYmhp1T19JpQ4iB5Hav1PYMi4zQyXJpDwu KNnUVAA/6OKS3aP0UV50Jls+AljS8+0F2eVqodXjfk4WglbBGUn+YntuWJqfka8IYp/H UDly7pft+m6I6+EEIEBGIK3sxG1Z1CCF8WXK+TAWeJlErjb1ilQDAw4c9m5glILMfL8i Cgu/v/fWEcV8uPiie0As7q9M6LHnhQGaYv5dCW/K20EFnb2473pUxUCjVkYHaxpz3Bqw b5zw== X-Gm-Message-State: ANoB5pnYkOPNg/MGJZ0nrQaPxcsY7XjEXA1LfTcj4Mg1VYnagbtZzb6+ 8IOFjw1sjse1pzdg4f6m82Ox4Q4jeFTym17E61OckncFMME= X-Google-Smtp-Source: AA0mqf7nwrslfax4ePaehsEQ3XpYge+Vhk3CpBPFuX4Ld2vGrB6F6t/KQ9bsaIbizZhcCsLx9mUf7FmiXjay5Gz0iV8= X-Received: by 2002:a25:25cf:0:b0:704:9d40:ecce with SMTP id l198-20020a2525cf000000b007049d40eccemr14386777ybl.316.1671523652831; Tue, 20 Dec 2022 00:07:32 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 20 Dec 2022 09:06:56 +0100 Message-ID: To: Go Kudo Cc: internals@lists.php.net, =?UTF-8?Q?Tim_D=C3=BCsterhus?= Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] ext-random: add random_float() ? From: divinity76@gmail.com (Hans Henrik Bergan) >returns a value between 0.0 and 1.0. wouldn't it be better to follow random_int(int $min, int $max) design? eg random_float(float $min, float $max): float On Tue, 20 Dec 2022 at 07:27, Go Kudo wrote: > > Hi Internals. > > Congratulations on the release of PHP 8.2. > I just recently upgraded production PHP from 7.4 to 8.1 :) > > Now that my work is done, I was thinking about a proposal for a sunsetting > of existing functions for PHP 8.3 based on the features introduced in > ext-random, and I realized that there is no alternative to `lcg_value()`. > > Essentially, this could be completely replaced by > Random\Randomizer::getFloat(), but there are easier `random_int()` and > `random_bytes()` functions for ints and strings. > > The Randomizer may be overkill and complicated for PHP use cases where > random number reproducibility is not required in many cases. > > So, why not add a `random_float(): float` function? This function, like the > others, uses CSPRNG and returns a value between 0.0 and 1.0. This behavior > is `Closed` `Closed`. > > Opinions are welcome. > > Regards, > Go Kudo