Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:119188 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 24241 invoked from network); 20 Dec 2022 06:27:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 20 Dec 2022 06:27:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D45E41804A9 for ; Mon, 19 Dec 2022 22:27:21 -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=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,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-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (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 ; Mon, 19 Dec 2022 22:27:21 -0800 (PST) Received: by mail-qk1-f174.google.com with SMTP id e6so4790719qkl.4 for ; Mon, 19 Dec 2022 22:27:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=colopl.co.jp; s=google; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=OpEypWdHAOi+alZD04j3bSmwlBGf/AZxisExTsToKSA=; b=S11Ca4IVfVBseTwGFFU2HQZLTALkAcUuAs8oTDBLDlc5oeFGvS0xOoWyIe6CrqsqoA J1zpvDJVqoRxZ5LjF+Gbw4j1rXKTnSrwcxz2wiKl0uME4B/Wj4LRrLy3XB1xliM/7ji7 ZdLah1omgrLF++9qxxdtLiBnMfDkHe9hn94/dojtiluZ9YXkoreIhkMJFjpEphg/YaLD d+4rsjIbA5Re20Oc2ru0wyYCAp3yTVxDNc1axCx8FuwzFGZk9CE/EUebBT1BYtFaUZmV EBOdWyUmiaMu/PhNik7SZ5H9Psoh9rGslsjk7uFtbIvXt1uFyos+0YsNi6ZaGypqcDem jI9A== 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:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=OpEypWdHAOi+alZD04j3bSmwlBGf/AZxisExTsToKSA=; b=X+MCYJyY3uUkF7BpcWQXHVomsxfGTQocODG1kVbkeAVGvRAM6mYhvTKr0mC8bJA4Pw ppjDlDA/pnZoQUJmwDS4lZYfya9kUrixAeYTMGy5geNHmJFVelpIIbSOITv1mW+C5Y2D diapRuj9OzSswBVRSiE6529pPZw/KGuIpS9/vp4HEtdzgSTB5Ile9Dm5cuMyWQej3jPp EefU31hVxvVTv+hLTk4TKmruh3LB83ke5z2lHDhlKCUEWsbH84nWRrnEHO/UrcpHVZl4 Alj9jqVw7P5cpCVPfa92bvlnYOcX2WUydh+alSysKsKAR67nZoIgtFIpFw4j0ldRecUW vuCg== X-Gm-Message-State: AFqh2krtFp3E2gOxSxWu0eD6uhcaSRFQiSsC88c+371P6HgNYqEG6XMa bsQ6WF4Vd7X2uGM7/YRJtrqnDuQTHDey+RPHdBJQkGm0GH4e8WU= X-Google-Smtp-Source: AMrXdXuN85wQEgUwi11aG25qi3onYRfNiwaRRqH6Rt/Xhydrdnmp1eYpemoGPK/gpO4aGftFNbTNRyPBkwuOVqEuRVg= X-Received: by 2002:a05:620a:c0d:b0:704:9b13:b2ad with SMTP id l13-20020a05620a0c0d00b007049b13b2admr23895qki.611.1671517640312; Mon, 19 Dec 2022 22:27:20 -0800 (PST) MIME-Version: 1.0 Date: Tue, 20 Dec 2022 15:27:09 +0900 Message-ID: To: internals@lists.php.net Cc: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Content-Type: multipart/alternative; boundary="0000000000002fe02405f03c876c" Subject: ext-random: add random_float() ? From: g-kudo@colopl.co.jp (Go Kudo) --0000000000002fe02405f03c876c Content-Type: text/plain; charset="UTF-8" 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 --0000000000002fe02405f03c876c--