Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117060 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 62908 invoked from network); 18 Feb 2022 08:59:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 18 Feb 2022 08:59:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 86ECF18053B for ; Fri, 18 Feb 2022 02:18:21 -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 ; Fri, 18 Feb 2022 02:18:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1645179499; bh=Wa1+SLdvSzPpVTnAXKorokCz8F6eC2d7X68f5SIcuW4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=DYgBAalD4uCTX7sinBa9I1R0QTtEMz3C+f1qSVsFvfd9AtFTUpL1shuO05TZ2DLiB 3EvjrqmVUaXQU2loIfK9oyrHu6oeIA0xDeNE5//3sTbqs6o+Lqk3uPPRELG1W5U9Ku fSa6FW+eubOF9ttg7ceG+j5JwtaEdLDcnogVzxDKEjt9eCoV5AJeB7GgGIYRcnRvbL qy5XiS6eCACs3oNFrdsh7T8p3AZ1N2mZg+wKvuId6L4nIP//2wWKS4MVnJpuUixk2U 8uO1Kh9yqc5xA3+Hay8u0wrMIfJoI2QxDxFb156cR4e2HuosjKQNMiL65Lb9kdNcGZ pXcBa1Ko+WaTA== Message-ID: <044ba2f5-1fd9-63fe-e04a-e648496eeee0@bastelstu.be> Date: Fri, 18 Feb 2022 11:18:17 +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> <2c667812-88c8-0b7b-3558-561a1348d0b2@bastelstu.be> <5f496cf9-8754-b009-9cb5-b978222b2249@bastelstu.be> In-Reply-To: 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/18/22 04:05, Go Kudo wrote: > As for your question, buffering the output can lead to counter-intuitive > behavior in code like the following. > > ```php > > $engine = new \Random\Engine\Xoshiro256StarStar(1234); > $randomizer = new Randomizer($engine); > > // Retrieve only 16 bits (the remaining 48 bits will be buffered in > Randomizer) > $str = $randomizer->getBytes(2); > > // Generate a new 64 bits (to waste) > $engine->generate(); > > // Retrieve 64 bits (first 48 bits from buffer, but last 16 bits newly > generated) > // numerical continuity will be lost. > $str2 = $randomizer->getBytes(8); > ``` Personally I'd say by using the engine itself or using a different Randomizer it's clear that any kind of guarantees regarding the result no longer hold, because the state will be modified. I've also seen your other email and will reply to it as well. Best regards Tim Düsterhus