Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112528 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 70859 invoked from network); 16 Dec 2020 17:16:18 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Dec 2020 17:16:18 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 67B8918050B for ; Wed, 16 Dec 2020 08:47:32 -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=-0.2 required=5.0 tests=BAYES_20,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-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 ; Wed, 16 Dec 2020 08:47:31 -0800 (PST) Received: by mail-ej1-f46.google.com with SMTP id d17so33711986ejy.9 for ; Wed, 16 Dec 2020 08:47:31 -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=8Qkp/VbI3Rk4WnZfgmVOuCVEecMCJG1MWWOPgraAaok=; b=C+FuVObLgYPCLcytIp7dgVayCyyN9g3hPRc6S5YQmRz+3u3FRjxB4WsSAx1XyOueOp JAJZVftDGY0mRhnVEIlMhebuH8hQpmKL+RuCZI7Li0YuRoB8uEzQYpX0l5YuSx8jVR6o XUSxy2smVASPZMOqRGPLNrLDi5K+AMIWww02rTGVnlF3Uk9ukDgVUBRFTkPBugSJ22Dq RqSQkJrthN1a0MuiUN0uE1hJH9IyhKAlJFmLzj0CecxYUwjFWcnFcwi6tO164+ZKB387 NPHPE+2qKHf2j+oAOTEUW98adkkoogpvTs03WG5/LGDV8dRmtN3VdW+fA5Pj2H0ssPjI iUDg== 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=8Qkp/VbI3Rk4WnZfgmVOuCVEecMCJG1MWWOPgraAaok=; b=abcKLoaLx2s4D2rJflohKEBtN/krmitHByOY0KdSgoVwK+x8R1NPclIgET4DfbY2zW vyJ/8ZF6JodqZqCYdZettKq8XMF20HaN0lmsnwpPj7iLNLWsc9DKGMriDp0U8oOv9y/9 wiiwMbsOOM1AcS7WTNqtG4dmkxSoEn73dS9D7Jfi9bovaWE1kL2d6sZNkiJTaNpjtQs2 UBWvKo8vfzhtC59VGlfhNGLd39ErZ/Z9By7o6S0xFQSGU25wrGtit2zi3o5ppDUHvO12 xgVX2hM2R5Wusyx8Anry2uh2jl3y1n0C2dL33lEUFDVdzRV5KztCQhKgXtws2QcufKmy r+zg== X-Gm-Message-State: AOAM5318R0W4KU8R2PqHym9OhB5sbbFxS5xrjNxZyDDoajDGFzUe34RK 5KpK+BSNDffb2Zk1IxZrP/A9fC0YpcJFv7VJurD+O+vlTzjKUU0A X-Google-Smtp-Source: ABdhPJwUdtPjsZBmHvJD0pS8plEJcqhbesSj5h4Kxv0JYcgOxUrYOnktIQo9UCf+NiHxJ3OGY8iyBFGhMtxMDyXISEk= X-Received: by 2002:a17:906:ce21:: with SMTP id sd1mr30963508ejb.396.1608137249820; Wed, 16 Dec 2020 08:47:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 17 Dec 2020 01:47:18 +0900 Message-ID: To: internals@lists.php.net, Sara Golemon Content-Type: multipart/alternative; boundary="00000000000086931f05b697a13b" Subject: Re: [PHP-DEV] Improving PRNG implementation. From: zeriyoshi@gmail.com (zeriyoshi) --00000000000086931f05b697a13b Content-Type: text/plain; charset="UTF-8" On Wed, Dec 16, 2020 at 4:56 PM Sara Golemon wrote: > Welcome! I'm about to knock down your suggestion a little, but please take it as constructive feedback. OK, You're welcome. And sorry for replying directly to you by mistake. > Can you clarify what object handling provides? Is the intent to have an expanded API for producing a reliably predictable series of numbers based on more finely tunable seeds? Iterable PRNG generator? Object scope PRNGs are useful when consistency of the result with respect to the seed value is required For example, the following code will result in unintended behavior if the generated values are required to be consistent. \mt_srand(1234); foo(); \mt_rand() === 411284887; // false function foo() { \mt_rand(); // code added } They also have the added benefit of being serializable. Being able to serialize the state allows us to take advantage of the PRNG's random periods. > We've had that since 7.0: I'm talking about the call to the php_combined_lcg() function inside PHP. This is still in use today for various purposes such as Meresenne Twister initial seeding, sessions, etc. > Bundling extensions usually comes when an extension has shown widespread popularity/use. With all due respect, this repo is less than two weeks old and has 8 stars. Who needs this and why is it not services by the PRNG and CSPRNG options already available? I am not planning to bundle this implementation into the core, and I think that would require a deeper discussion in the RFC. I plan to implement it in full scratch according to the results. --00000000000086931f05b697a13b--