Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118116 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 93394 invoked from network); 28 Jun 2022 13:48:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Jun 2022 13:48:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0D25A180546 for ; Tue, 28 Jun 2022 08:39:58 -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,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-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) (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, 28 Jun 2022 08:39:57 -0700 (PDT) Received: by mail-yb1-f182.google.com with SMTP id r3so22893839ybr.6 for ; Tue, 28 Jun 2022 08:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oRgQt4EsH7E/VFfPc0TPEB+CdTEvd6yO4VboqUdfSJk=; b=TzNycmy9dFqw1J4J8wuznfGwSHpfS+7gptnPP29KmH79DgdEklryKHNvnURg+VZPl+ RFCM7bcgS1AthE7b6y3N6TGglfBN34EDp3zwhNjEZwZV9bbkWffbYH8F0J6wKAL5lBDo 1JbfXa6JzfLWGt5rF+wykER78j1SvKdYgR3CPJ7l8BVtMbGfkVbhmcU08fWoHPOgEOjn L09NoqvVuraazh4yyWriFr31dUZeNzl4ra+lI3xkl1GrQ6BpprqtzbS4On9nrU3nPP27 zya2NyFf9Iwf+Z8KjjmqxNzRRzKnzmKKqV2Tp0wxC2mGIa0oIq/SgArIKlX6bswBqxTp iNzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oRgQt4EsH7E/VFfPc0TPEB+CdTEvd6yO4VboqUdfSJk=; b=z5YDFZD1/CYK2YVXZt64KY0eFpcP70QZ4+4aoNI98E2I3COkSSDcjS9jY/jp1Sob3C LZSll1rTUOsCyxGEB0UtnxmHmYybeuREtNnbKNK82YR41Ac9ofVUZJs44zUlXjNxWFWg P9iRHlMXcJLHTR/gzluiunlBxT4n3/arloAg5muBOTS6oGYQLpELzmlP2sPT80fN+Q6k nLzkdp/jXlpMbE1lrtmKSyv/ojJ1mM8gYIvMk/USBR3Nd9CVfB+VLs56LpAz/bQlnUE4 OlcQ9sGYU9seyiYngtT+4hilvrKXE6payAdzeOzxAO/BPZOsA0sNPmpkVz3KYm+/aeGu cckQ== X-Gm-Message-State: AJIora+IYc8JBG1CbWT0/YMwWKzGMlP4tf+aYa+Bh7qF4lwb4QTszO+R tsvShLcZFZuCTM/zu/lfNcBH9niMGS0om1SvHQ== X-Google-Smtp-Source: AGRyM1syOyp3BEZcQMUuOiHFJ3/Y1dhAI0UIb/YmX8sfOJKCdK253SqwUFDulqF6bzNl4up0iXjKDrRjpDBSPXDB9CY= X-Received: by 2002:a25:8051:0:b0:66c:e6f5:d56b with SMTP id a17-20020a258051000000b0066ce6f5d56bmr9708091ybn.354.1656430796834; Tue, 28 Jun 2022 08:39:56 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 28 Jun 2022 17:39:45 +0200 Message-ID: To: Go Kudo Cc: Go Kudo , PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] [Under Discussion] Random Extension Improvement From: guilliam.xavier@gmail.com (Guilliam Xavier) > Hi Internals. > > Random Extension 5.x has been accepted by a vote of 20(+1)/0. (I made a > mistake in timing the closing of the vote and thus received one more vote) > Therefore, voting on the Random Extension Improvement RFC will begin on > 2022-07-02 as scheduled. > > Please check the RFC. This is the last chance to improve the implementation. > > https://wiki.php.net/rfc/random_extension_improvement Hi, I just realized a little thing: in the array_rand() example, for $beforeSingle, it would probably be "more realistic" to omit `, 1` (which is already the default for $num). Note: for `Randomizer::pickArrayKeys(array $array, int $num): array`, it makes sense that $num does *not* have a default value (1 would be "weird" because the method always returns a *list of keys*, and count($array) [via null] would be "useless" because keys are returned *in their original order* [so it would make the method equivalent to array_keys($array) by default]), and that's probably a good thing (it forces to update the call by adding an explicit `, 1` argument and reminds to add a `[0]` or similar on the returned value). An alternative design would be `Randomizer::pickArrayKey(array $array): int|string`, but migrating existing uses with $num != 1 would be harder, so probably not better. Regards, -- Guilliam Xavier