Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117963 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 17213 invoked from network); 16 Jun 2022 11:04:44 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Jun 2022 11:04:44 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EB64E1804C4 for ; Thu, 16 Jun 2022 05:52:43 -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,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 16 Jun 2022 05:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1655383961; bh=ngp5C6Oy3OOtxKXPQ3od5/xF2CR4nf7mpl1z/Mu7QJA=; h=Date:Subject:To:References:From:In-Reply-To:From; b=RCcmhZ2Zm//dqc/4Bv8BgXC8vPVh2dIS9/81bJ8UyYWeF1PrToaeij9dTMxEgkmmZ 0u3QuWIjyWvaDFwXhMa1tPuOpXEgQWysGR9j7dBYqWsxi1A2r0xBVzdIwCYyjNnyEr s2SjvL2wJYJsvAAJT/oF0U0nzvZui5Y/3mu8DqzMFEVrTNv8qilEj9kl1PcgS+3PmB ZrZ/lVWTm0LooyarKaoeYBbJpfGtkNdMflTlo0Dxxf5300AwkAbJxqBPC6SHrqqF7A 3Ij3jN1SPtohCen8fqCbu3yzm+laRU4jvk5wqc8HQyDDeZeMYUY7NAMdaiW5olc0SB A1CRL6jyzSAFw== Message-ID: Date: Thu, 16 Jun 2022 14:52:38 +0200 MIME-Version: 1.0 Content-Language: en-US To: Go Kudo , internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Re: [RFC] [VOTE] Random Extension 5.x From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi On 6/16/22 12:14, Go Kudo wrote: > If the content is acceptable, we would like to change the status of the RFC > to Under Discussion and make an > announcement thread to internals ML. Can anyone review the content? > (1) Engines should be final: That was my suggestion and that paragraph looks good to me. (2) array_rand(): That looks good to me. For the method name: Perhaps ->pickArrayKey() for similarity with ->shuffleArray() which also includes the type it operates on in the name? (3) Naming of PCG64: I must admit that the fact that PCG is a full family of similar, but not identical generators is one thing that made me (and still makes me) prefer the xoshiro family which has clearer names for its variants. It was also pretty hard to find the PCG definitions on the PCG website, but I believe that it refers to this: https://www.pcg-random.org/using-pcg-c.html#low-level-api? In that case PCG64S would be consistent with the upstream high level API name. I am not sure if Pcg64s would be more readable, though. It would definitely need a good explanation in the documentation which exact variant it is, though. (4) Randomizer::randomString($charset, $length) If we extend the Randomizer anyway, I wonder if we also should use the opportunity to add a method to generate a random string for a given charset, e.g. ->randomString('0123456789abcdef', 6) would return a random hexadecimal color code. This does not yet exist in the standard library, but I am seeing that many libraries implement something like that on their own, making it a useful addition in my mind. Best regards Tim Düsterhus