Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114692 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 41741 invoked from network); 2 Jun 2021 08:38:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Jun 2021 08:38:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B75F51804AE for ; Wed, 2 Jun 2021 01:51:33 -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,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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, 2 Jun 2021 01:51:33 -0700 (PDT) Received: by mail-wm1-f52.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso3247704wmh.4 for ; Wed, 02 Jun 2021 01:51:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seld.be; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=NhqJCW2PUVYSRjneyWxCPBgQqiZXsKWr4Hb+h9sQxxc=; b=gIEACUJGoLSZ/F8DwvvkJ969Qc61kquBi2u7NKsFMn6Vwh4hjitizNnCDSdPOtgSSh oIpoxgQfPaRmrOaAFGBChNYaiRa7bJX12x5hYf73alidutw2tiO6zBaKmkrIoKR4tgh4 TL+ld1RZXvp+p+r6hhbf9cFVIpA/OZyn41plLrFW9LU8i2uCxN9yUgpaN6QmP+evv95L 4c7FKwE5tww8WCR66jzZz3NELdULtE3uMpFYIIxR7dPYjBwXuSTj7Hf6uniJOfOxR/Qq Fp7td6f0DKGeUv3ReJm9NcnV4Cyzk55izjWCTEU1YEdK7P16PwmsGX0sas2PQpfOkR4L DOqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=NhqJCW2PUVYSRjneyWxCPBgQqiZXsKWr4Hb+h9sQxxc=; b=cXFs+TdK2FVXNf0yA1LVzxG5RGt6ty5ZRRS+RsneBHa248QoYSJs0vCYIfhM+cIuDB /+GUdJUsraYUT3mrZ7Jp+vIOFQniGku60xt8hPNI+uR6+Flu3NxZo8X4yFrR5K/cvjtT 3D8bPFjRFnArsrRWyFOO+5fjqO1zLaf+54S7tsA2p4r9fsbg9IjhtzBcjOW7HtuySwc6 2BxVfY0QVdWxI2qY8Gn0Z7vl8VTlC7vb0bWrPcAg2scF6mO8UCU1TQEubV+HFovSrQuK Ao/a8VM2qKF2T+qvpQhP3kXRiSlQ55SZbZA0fHjiYvCKCOYeGdYysHH/xB6kW5nBHc3e Dp9w== X-Gm-Message-State: AOAM531M2GugwIARHSqHTq+Jr0zgRf7xzEaxOpbA++QaQPmpL/Ml9PZU mHeGQlI/xoKu3Pu3r6OXWf2qRiQ3v2xe+g== X-Google-Smtp-Source: ABdhPJyNaAl9TET/Hy4XvEoLX3KtpiwvED0xe7xqtCB/NZilR74PFCtRVUUbMewewtDyiZxZ/cLC0g== X-Received: by 2002:a1c:e90d:: with SMTP id q13mr30815769wmc.163.1622623885792; Wed, 02 Jun 2021 01:51:25 -0700 (PDT) Received: from ?IPv6:2a02:168:4b6e:0:8463:40f8:e947:1303? ([2a02:168:4b6e:0:8463:40f8:e947:1303]) by smtp.gmail.com with ESMTPSA id u8sm6204052wrb.77.2021.06.02.01.51.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Jun 2021 01:51:25 -0700 (PDT) To: internals@lists.php.net References: Message-ID: Date: Wed, 2 Jun 2021 10:51:22 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [PHP-DEV] [RFC] Under Discussion: Add Random class and RandomNumberGenerator interface From: j.boggiano@seld.be (Jordi Boggiano) On 01/06/2021 16:28, Go Kudo wrote: > Hello internals. > Thanks for continuing to participate in the discussion. > > I've sorted out the proposal, and finished writing and implementing the RFC. > (Funny, I know.) I think it's time to start a discussion. > > https://wiki.php.net/rfc/rng_extension > https://github.com/php/php-src/pull/7079 > > The main changes since last time are as follows: > > - The ugly RANDOM_USER has been removed. > - RandomNumberGenerator interface has been added for user-defined RNGs. > - Random class is now final. > - Random class now accepts a RandomNumberGenerator interface other than > string as the first argument to the constructor. > - INI directive has been removed. In 32-bit environments, the result is > always truncated. Overall this looks much better! From a PHP userland perspective I can't see any huge problem at first glance. Just a few notes: - "Random class can be serialized or cloned if the algorithm supports it." It isn't clear to me how that support is defined in a userland implementation? Simply by implementing __serialize/__unserialize? - The __unserialize docblock has two typos (Useri*i*alize and *in* instead of if) - If an object is passed to `new Random($obj)`, probably it should throw an InvalidArgumentException if a seed is also passed in, as I assume in that case it would be otherwise be ignored. Best, Jordi -- Jordi Boggiano @seldaek - https://seld.be