Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114594 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 61522 invoked from network); 25 May 2021 15:24:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 May 2021 15:24:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5F528180507 for ; Tue, 25 May 2021 08:36:02 -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,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 25 May 2021 08:36:02 -0700 (PDT) Received: by mail-ej1-f42.google.com with SMTP id gb17so29987966ejc.8 for ; Tue, 25 May 2021 08:36:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MR5fVt2tNc2pVOctkHz3obhiZQJADQf79auPH+6GC6g=; b=nquutgWl4qJBlRyfHDWOHFuKs/mJmBPDaZQrZxCZfteyKRd4+kNRg6w0PMNuvqLqrL YnGntAPb9h/s5KrreDwvLcTK1LHC6zXjNKLemYx+SrZKy3uiwDLMjXG4+ehcVz3C4yNi qfKX6yprhoB8Nx1QiWyHCzc8BKMnr52ceQHM/UvAEG8Fj+3UkpY/A0RHeIuBzlt2JYHf BQDd+67dy50sK69Sdhx3xf2DLn1hs8mDS0FcHDkwSZK3FkYg/iDj/OWzgz/7JGsw5uXX dePF5ZJvHXtyq5FxFd4TYD7/PeBYov8jbGMZhJhRJKJ/e5vZIh7nLQ2227QRgWs+i0Cv HvnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MR5fVt2tNc2pVOctkHz3obhiZQJADQf79auPH+6GC6g=; b=pbC+B3i91S6v3/i3Y4jPJHBsgrLXEVQvtAduD4oVdumAqEfKv4/FQhyOMnHvOmM7Rh Ja65ZtCWNvRJImzJvxT0CV8vuxw9EHYOvUK+jyI9HYJaDylvTsfiFTsqquF1ey0OR8WB UwLOIJYQ+BGPpKKF0UYxFkAV96Sd2pqrpSf2/c+Cwy0ak8Zw+tziJkesbKbOTjeOe6JZ PjKZNqanQQe0t1pLQx+pE3Jd1EjMNu8XZ0KbrR8cm5ITG8gKKnAdcOh93okycTDv3IpK moZRjjDUgwRIOnGAV0sYHdyevIns0YlSzNocxLkhD81FocFbtJC3+HegszcouLmvOlzs jhYg== X-Gm-Message-State: AOAM530e/Gwgb42Hsc8n1GDXEU6Q18wjn7WDLiGG15hYzfAkcC5zii2l znrhrr9gdYuSIPEbaRNGy+/sfrpXVTYof/uCCNg1l1BRSPY= X-Google-Smtp-Source: ABdhPJxiWsoQq2l6Rf/bz9Ow3TY242h7TvHHC9zIbDcL95Tw65jna17DRdxvrkqy23ft1CJ/M+DlmhYT4Mfoa1RuB2I= X-Received: by 2002:a17:906:b259:: with SMTP id ce25mr29049205ejb.245.1621956959753; Tue, 25 May 2021 08:35:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 26 May 2021 00:35:48 +0900 Message-ID: To: PHP internals Cc: Guilliam Xavier , Kamil Tekiela , Danack@basereality.com Content-Type: multipart/alternative; boundary="0000000000006d571b05c329480b" Subject: Re: [RFC] [Draft] Add Randomizer class (before: Add RNG extension) From: zeriyoshi@gmail.com (Go Kudo) --0000000000006d571b05c329480b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Thanks for the response. The RFC has been revised based on the points you pointed out. https://wiki.php.net/rfc/rng_extension The main changes are as follows: - Class name has been changed from `Randomizer` to `Random` . - Added a static method `getNonBiasedMax()` to get the safe range. - `int()` and `bytes()` have been renamed to `getInt()` and `getBytes()` for avoid future reserved words. - `getInt()` arguments no longer accept null. - `shuffle(array|string $target): array|string` has been separated into `arrayShuffle(array $array)` and `stringShuffle(string $string): string` for more comfortable static-analysis. - fix: php_random_algo struct (included uint64_t -> int64_t) Answer a few questions: > When $seed is null, what is used for the seed value? Depends on the algo's implementation, but basically it is using internal `php_random_int()`. It is similar to `mt_srand()` on PHP 8.1. https://github.com/php/php-src/commit/53ee3f7f897f7ee33a4c45210014648043386= e13 > Why cancelled RNG Extension? As a result of discussions during the draft, the functions became a single class and no longer need to be separated. The functionality for random numbers is now included in ext/standard and will conform to this. (e.g. rand.c random.c) > Deprecation Dropped in the last RFC update. These were premature and should not have been included with the RFCs that add new features. If the direction seems generally okay, I'd like to start implementing it to show more details. Regards, Go Kudo 2021=E5=B9=B45=E6=9C=8823=E6=97=A5(=E6=97=A5) 5:56 Go Kudo : > Hi, Internals and all participated in the previous discussion. > > RFCs have been cleaned up and the proposal has been substantially changed= . > > https://wiki.php.net/rfc/rng_extension > > First of all, I apologize for not checking out the implementation of > password_hash(), which is a precedent to learn from. > > I think I've answered all the questions I've been getting on Open Issues. > If I have left anything out, please let me know. > > Regards, > Go Kudo > --0000000000006d571b05c329480b--