Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117990 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 61680 invoked from network); 17 Jun 2022 15:58:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jun 2022 15:58:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 905EF18054E for ; Fri, 17 Jun 2022 10:46:36 -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,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-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) (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 ; Fri, 17 Jun 2022 10:46:36 -0700 (PDT) Received: by mail-yb1-f173.google.com with SMTP id 23so8417108ybe.8 for ; Fri, 17 Jun 2022 10:46:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=colopl.co.jp; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=dY063jPUOOsK3IzOb7UvjCW4LRm9L00ZvV1/1Zi6YIE=; b=N58DXEZ9O+KE/6n5onU8LNSTGatx+iVTVSaGjfD3r2b1hIlKK72a7S1RQvFFhbG2G6 dnAaBZslahoCBgYN+NX4xIzcyHVBRjlLXn0qMz9kQTHhvawU4NknFwRpSoT0GlHNJmjz hz5y1xHb6yDuXv2WkmZs+9qKvGLiYTUg32fEDkVvL5BTAyRdZ73m/NBJaFI0npY4rLP2 pa4r7BzcZTmXu/rq1q9thPoxpLnS5fZIhy9OiT4W+RKxi8F3k6lXCphMIbwRKzmUdnQo cGfT4cUma7aKxdiSvJqPsukQWrbED03NYRJd+N42dC7cMXKp7n6iIafSdOu7YU+zHnXo F7Dg== 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; bh=dY063jPUOOsK3IzOb7UvjCW4LRm9L00ZvV1/1Zi6YIE=; b=oUdjRoQGzDXWpeRTHsb/8D2fYH6YL1nm4m/GmCfOvFZULV6jL8ir7DDPZs5eVI1Tnb BpJd78CA5kxib6JCOf3st1LlLfOWrIi+FxpbCfodl0WvA/1nTZLIsgz01f5yVaycDJVC 9BaffL5aHCbuZp7dk0AtiN+hQ8k1NTUnihw2rbHaZ+hJKb5AgNk6aaj61MSEKDQR9mkk DfPSxw4frfeQvmfaMKWp3cvPrupKjEdPO03tQKXnvlpGPWVoTPWt84XCIr/sirkCz75Q FpydjP+rHsGo/1z373hOp8lMBzsFz1JJFKnRTzm6RBbbaHjRdOuCkZxXWmkdWVCJBDSU L5sA== X-Gm-Message-State: AJIora/yK0bdYo167IGwGtl2Yg91WHK7IP1OrbLQRXwzhpBa9OHhIV0T uK/X+O+v48S8l91Zcb3DEnWmpZDGhYh2qqNSkc9mvXpeRCBY X-Google-Smtp-Source: AGRyM1vn7X5P05GQKvnu7J+ttvP4dI29z6wh3Z+n63nXyPAkOP7VBZpI97yXH8RCR98xU+ce1dcBGDzheFabwTmLWGw= X-Received: by 2002:a05:6902:100d:b0:665:f7e:10c4 with SMTP id w13-20020a056902100d00b006650f7e10c4mr12844349ybt.494.1655487995639; Fri, 17 Jun 2022 10:46:35 -0700 (PDT) MIME-Version: 1.0 References: <77a64074-875c-cfd6-5811-24b9d445f550@bastelstu.be> <3aac541e-b80d-1106-369f-a00a3a718f90@bastelstu.be> In-Reply-To: <3aac541e-b80d-1106-369f-a00a3a718f90@bastelstu.be> Date: Sat, 18 Jun 2022 02:46:24 +0900 Message-ID: To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= , internals@lists.php.net Content-Type: multipart/alternative; boundary="000000000000e9115d05e1a855ae" Subject: Re: [PHP-DEV] Re: [RFC] [VOTE] Random Extension 5.x From: g-kudo@colopl.co.jp (Go Kudo) --000000000000e9115d05e1a855ae Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 2022=E5=B9=B46=E6=9C=8818=E6=97=A5(=E5=9C=9F) 2:37 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=C3=BCsterhus > I was fundamentally wrong, I understand now. As you said, there was no interoperability with `pickArrayKey()` in the first place... > stringFromAlphabet() Hmmm. I guess randomString would be better then. At the same time, it would be nice to have an array version of randomArray. However, I don't want to add more methods without any thought. I think operations that can be done on userland should be done on userland. That is why I did not implement the array_rand() function in the first place. I would like to hear other people's opinions in this area. Incidentally, our own PHP implementation of the library (Xorshift128+) has equivalents for arrayPickKey, stringPick, arrayPickValue, randomArray, randomString. And it is useful. Regards Go Kudo --000000000000e9115d05e1a855ae--