Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117989 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 59953 invoked from network); 17 Jun 2022 15:49:20 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jun 2022 15:49:20 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6AA2318055A for ; Fri, 17 Jun 2022 10:37:38 -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 ; Fri, 17 Jun 2022 10:37:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1655487456; bh=D3hOdAtu/d0zCywRd9d6B5xKFsW788nbIOik46czzoc=; h=Date:Subject:To:References:From:In-Reply-To:From; b=DGMTv5A3G7ybeJvGj8g5veP3ynw0owIXriWhk+T4O7uZnhbzKO0AULy3RdhLmq4LI mSoC1VT/zykuJcNGRyQiOfeD3aZjJKzWAdJ5V/+FdxI13Ap8nFM4J47HzeGmZJdbHG 21DEgrwt7nETe8fjwjAyFO6PpQ1dzjgI2VZirDMCCwTR36kiTFShHwzLlUtTSQkyVJ 2Lv1vg57nbqdB84RVs6WDAtAS8IOeVHdrebOprA38UQek3t58IL9RI4hXZ3fWEWJHA Yn6xk4x9nXU1No9na12tuUADqMnSll7Vncuagv1wm7Ngj1gzV8ijGLIdLCy8OY9p7j pyAnz0MMcVA2w== Message-ID: <3aac541e-b80d-1106-369f-a00a3a718f90@bastelstu.be> Date: Fri, 17 Jun 2022 19:37:35 +0200 MIME-Version: 1.0 Content-Language: en-US To: Go Kudo , internals@lists.php.net References: <77a64074-875c-cfd6-5811-24b9d445f550@bastelstu.be> 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/17/22 19:28, Go Kudo wrote >> I don't think that ->pickString() is a good name > > I see. But I think `randomString()` is ambiguous with `getBytes()`. > > `stringFromCharset(string $string, int $num): string` solves that, but I > think it is possible > that the meaning of "char" is not well known in the PHP world (although I > think this name is most appropriate) ->stringFromAlphabet()? > How about adding an optional `?int $num` argument to `shuffleString(string > $string, ?int $num): string`? > No, because it would be pretty unclear what that `$num` argument would do there. It specifically would be different from the `$num` of `pickArrayKey()`. pickArrayKey() returns every key only once. Generating a string from a given charset may return the same character multiple times. Don't overload a single method with too many purposes. Best regards Tim Düsterhus