Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117030 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88142 invoked from network); 14 Feb 2022 15:29:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Feb 2022 15:29:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5D32F1804A7 for ; Mon, 14 Feb 2022 08:46:29 -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=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 14 Feb 2022 08:46:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1644857187; bh=qwxbD8BWF/UHl1COWnweWCAp9An4h1UxzJrMQejNn58=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=FdcAj/eCMK97K4J8hfQM5tLy2QQDh+VbBlZtV/UADTWRpQlzb8noLZTaYkmL/Yzlc jjb00WJBZhpELHosxV7aXkr8w7yXX3eu1INnTmDDgBLM+/Q/7JWtZtGaxGiaqT1Aav NdLtEMya6S5tYrWCOV4ABCQJwbiH0KJ4x8Vk9YOR1wDOT+NxAwDtSLNkiHdnahc+JL wyNIsEzCWBw9lgMl3J0K54yLjYcL2evCgjVCNa8ttoWnSd9Oicy6Ye4Z6cKJu20S33 w2rAe3ljjOkdQWzmk2Ds64buxxwbSLaZjqG2bC5uCrcBbJFFdVaartZsChEyssgKdr qHYeYpy/yPdxA== Message-ID: Date: Mon, 14 Feb 2022 17:46:26 +0100 MIME-Version: 1.0 Content-Language: en-US To: Go Kudo Cc: internals@lists.php.net References: <41a1b458-4941-f34e-f1b4-e25b3298b80a@bastelstu.be> <553ba7ca-3821-c2d9-f88f-b216013a887b@bastelstu.be> In-Reply-To: <553ba7ca-3821-c2d9-f88f-b216013a887b@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] [Under Discussion] Random Extension 4.0 From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi On 2/14/22 16:44, Tim Düsterhus wrote: > Unfortunately your PR doesn't compile for me, so I can't test: > > make: *** No rule to make target 'php-src/ext/standard/lcg.c', needed by > 'ext/standard/lcg.lo'. Stop. I've managed to compile it by cleaning the whole directory and rerunning of the build steps. Not sure what I missed the first time. I've now been able to play around with it and have some additional discussion points: 1) Consider the following script: getBytes(8))); var_dump(\bin2hex($r2->getBytes(4)) . \bin2hex($r2->getBytes(4))); As a user: Would you expect those two 'var_dump' calls to result in the same output? Personally I would. For me that implies: 1. generate() should return raw bytes instead of a number (as I suggested before). 2. The 'Randomizer' object should buffer unused bytes internally and only call generate() if the internal buffer is drained. 2) Why xorshift instead of xoshiro / xoroshiro? https://vigna.di.unimi.it/xorshift/ says that: > Information about my previous xorshift-based generators can be found here, but they have been entirely superseded by the new ones, which are faster and better. That would imply to me that xorshift should not be used in new developments. 3) Consider the following script: