Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114693 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 55501 invoked from network); 2 Jun 2021 11:42:50 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 2 Jun 2021 11:42:50 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DC6001804D8 for ; Wed, 2 Jun 2021 04:56:05 -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_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-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (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 04:56:05 -0700 (PDT) Received: by mail-ed1-f51.google.com with SMTP id r11so2531874edt.13 for ; Wed, 02 Jun 2021 04:56:05 -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; bh=efDDD+XEgumQetM2QPcREjR8HOYDmyHhcsu+ohV4uEA=; b=lWzAE2861zQvTP9XhJzQDdcGPbw+C4QBTgT1nR3IJyqlb4TpO4+9uKFDUuNCdFl+JN Wl39XgvX3IBheF7ssD13W/bysSE2I83GhlL9ycEsC6l86iLcWip3KIsiEogzNbSokPpf nh2gPv7hDcSgxTQoRMxNzxRGNzJDvPF2cWBmWnN5zG+20Zlco+lB/qQ/J0S8zjt36nIV 5k1qMhTJzDn79wQWEYDWCSaXzSXlB2PHLk6sBjigZeFMxjEQxsijoal9VNLlILM9O8dA RU3oD1tilAJnioxsRWLxpklnP3do8ttqYVOl9h7ufH6G8Ym9f/1V/n4hQwJpQG6fpnat rg6A== 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=efDDD+XEgumQetM2QPcREjR8HOYDmyHhcsu+ohV4uEA=; b=WicxK/1br2ux+GoakC7dbxTA7kXpWXkO2zKEwXnhAayW4fmHuDNdDXZDxKjlQ057ho W5jjgd5WP2OV7xtnGWYTvWhgnzWR3LccyrNB+RVYl8BgRbuxmH3aasNPP0Tsh5Q0+Z+h hJ27SoxN6BQqI89MsjMZvo9YAnthuE9+fL+OBA1e30hoSXt1nII5897QXKDh35VPa/ls 5f4V+THLfVEP+3wgEzk2ILbUWsr29RRuj512Q0B9qRI30KULqH+w9uK6Ph0Kmu9OwAy6 RU7UfdnT9gCXZInP/OJUFuqUauWWWPSaA35HrruZTiscbZUuF1H/GsEfsekgw6jnplX4 +V2Q== X-Gm-Message-State: AOAM533QrnhXxiFPNadIdzAlYJrutlThqmdlrg/t1NjkgSE3WBeRtjfG h6Q8t/dxvZuusWvdE+7tZtiJMtll4U6QRmvAeoxbiX6xURMZ2A== X-Google-Smtp-Source: ABdhPJxLeAqLJOZt4HANqIFsC6SqsWK2CurzG7/2gpFuEcJy5UZhy32lbLTJFLTUdvrQC326tgr+jHFl3AjVoRHg8q0= X-Received: by 2002:a05:6402:11d2:: with SMTP id j18mr34420331edw.135.1622634959650; Wed, 02 Jun 2021 04:55:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 2 Jun 2021 20:55:48 +0900 Message-ID: To: Jordi Boggiano , PHP internals Content-Type: multipart/alternative; boundary="0000000000005ec2f305c3c72421" Subject: Re: [PHP-DEV] [RFC] Under Discussion: Add Random class and RandomNumberGenerator interface From: zeriyoshi@gmail.com (Go Kudo) --0000000000005ec2f305c3c72421 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable It was good! I was finally able to put some things together. Thank you for participating in the discussion. > typo Thanks, I fixed it! > InvalidArgumentException I think InvalidArgumentException is included in the ext/spl extension, but is it safe to use it from ext/standard? If it is available, then it is certainly more appropriate. Regards, Go Kudo 2021=E5=B9=B46=E6=9C=882=E6=97=A5(=E6=B0=B4) 17:51 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --0000000000005ec2f305c3c72421--