Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112912 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88290 invoked from network); 17 Jan 2021 11:23:53 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jan 2021 11:23:53 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D26C0180539 for ; Sun, 17 Jan 2021 03:03:04 -0800 (PST) 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-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (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 ; Sun, 17 Jan 2021 03:03:04 -0800 (PST) Received: by mail-ej1-f49.google.com with SMTP id gx5so408570ejb.7 for ; Sun, 17 Jan 2021 03:03:04 -0800 (PST) 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; bh=nuGRI4nh54QDZwCGazLN3/MQ2p4ZqayXJIb5xlmDa0g=; b=qlP4hFpZlVQOA8f2FT9a7P7DVFdKJCGe9XBTGeLFFCcTRyvfFuohPurZByodRO/O7d JNq+uDrPtalOrZ4mcJEP24HCJekytMB2Gd+I+q3gxesEYBso338aUwloCYVJjQNFjuJ4 ncZQGkXCWpJ8NCm5NTIIUOyrOJQZxix4Kfjk5VqIuT4Bk/nKBSvbN8etoOQc2xchZJaL pcIKjzINi2+tWlCLE8XSrt9lF6C2lvWbi4Wnj5gzDxh2c2CpwprWCa9vTwsAVx9S2cw7 ltJYU1cp0xC2mBUcp9SbeDbMww+WLAaCK/Em2ymT/qbxOp+BRJzQ1YxCYO4jNUwTfDRh F3uQ== 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; bh=nuGRI4nh54QDZwCGazLN3/MQ2p4ZqayXJIb5xlmDa0g=; b=kAo7huE9y7MudsfLDvGqwEOJ0ptWucfemwmlLiJbkMKstfhPPblENLD5nvSskGWuGq ngQdifpDdIi7OjTqXjcaMwf4EC/DR92t8UVc5621O5jhWz+A/5PUtzbLEDzLXcDSlMgI U3QOhc+X0zYmBrpaZCd2cz+2EeeF676qPGCX4nW76x/uQajztiWQyut/Y6zhWTcl2fV8 tPXAuVQWAul2YVMxltKO6zMTFwj/DDVeCEM7jHxJ7tLh06NfCLlVLk301SuS9tGbs+Gy ZAKiLna6RhXulHUzGcaZKUVsYJglxhnLDHRin+JamVi9LsxQ4oksOfEnb2TIn3jJscp3 SpKw== X-Gm-Message-State: AOAM531w3596CLKdoEdF5iicefXav1Sr8ze8kMaRKJi1FHe3u2rAGi+B TXCLEe199qLKhZRNrvdhgT+A611spLgapjygIazxM3Y6Bn6QTw== X-Google-Smtp-Source: ABdhPJzC55dRgurLGafmC0ey8NPo/Vtf6ConuhX2kjPWwGunyBQM/+ThCjvjc3Lh4anmw7+QYcaUFxjq9UbfKsRveTg= X-Received: by 2002:a17:906:22c7:: with SMTP id q7mr14255277eja.486.1610881382617; Sun, 17 Jan 2021 03:03:02 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 17 Jan 2021 20:02:51 +0900 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary="00000000000096184505b9168c25" Subject: Re: [RFC] Object-scope RNG implementation From: zeriyoshi@gmail.com (Go Kudo) --00000000000096184505b9168c25 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Updated the RFC and fixed the implementation. Also made some additions to the RFC about when this feature might be useful= . RFC: https://wiki.php.net/rfc/object_scope_prng Implementation PR: https://github.com/php/php-src/pull/6568 (All CI passed) The main points are as follows: - The implementation now meets all requirements. (maybe) - Implemented MT19937, which is compatible with PHP standard MT. The consistency of these is ensured by tests. - The implementation is now what we used to call TypeII. - All RNG implementations can now be inherited like regular classes. Use faster calls only if the class is an internal class. - The implementation has been heavily modified and the quality of the code has been improved. Currently, there are a few concerns: - MT19937 returns a signed 32bit number as a result of the `next()` method; the mt_rand() function returns a bit-shifted unsigned 31bit number, so the results are not identical. - You can get the equivalent result with `$rng->next() << 1 & PHP_INT_MAX`, but maybe you should have a `nextUnsigned31()` method. - Currently, the test uses `$rng->next() << 1 & PHP_INT_MAX`. - The implementation of MT19937 is redundant. This can be merged. Anyway, I think the code is finally ready for review. Once that is done, we will start voting on RFCs. Regards, Go Kudo 2021=E5=B9=B41=E6=9C=889=E6=97=A5(=E5=9C=9F) 19:00 Go Kudo : > Hi internals. > > I think I'm ready to discuss this RFC. > https://wiki.php.net/rfc/object_scope_prng > > Previous internals thread: https://externals.io/message/112525 > > Now is the time to let me know what you think. > > Regards, > Go Kudo > --00000000000096184505b9168c25--