Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113910 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 61376 invoked from network); 1 Apr 2021 14:40:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Apr 2021 14:40:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9A5121804E2 for ; Thu, 1 Apr 2021 07:38:13 -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-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (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 ; Thu, 1 Apr 2021 07:38:13 -0700 (PDT) Received: by mail-ed1-f48.google.com with SMTP id z1so2209215edb.8 for ; Thu, 01 Apr 2021 07:38:13 -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=0IM6i0aGUxuaDSh5xKQcc09vkl3WeHL6pjafElj3Oic=; b=DFLUuM3/M/VkP3gl2O9qaARQPvZ2PeMiIfoN0bKsTIkVcI7XGT4f/nUrCZcx4uEwSI QivjexJg97MvrcQRi+HNRyFVruQHvf9l4XPlxdlU8FvBMdfwrzOrbU6L098Kejye9JZW 0LP1A61diur4mrJ77y2Ljm9HE9csNODAFPcaNiRgZEsHEi/A2XdTcLVV1j0wF2BdtWgW M3JTVALeShAz55duY4tDuzMWI3D1l/EOs4z+4HMKIMh+wYiiJzWZGVNTJI5gj7CyWW6d vAVVe9Evr15Y4+JOlvAjqiTyFZLnV+Np5wcvDa6NorYjwxCO0L2x++6OCLZF/naya1rE RqKg== 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=0IM6i0aGUxuaDSh5xKQcc09vkl3WeHL6pjafElj3Oic=; b=ucGBLI2zJ32Z6FKfvGNv6Hhdwbwv+m3U6JCUYnHxWg+l+Tp4IrKbgAaQU3IaBAF7r5 xofDaGVuKXL/7WTqu0xSd5cNrCtF1Tep+hUWcW07T5CfXypILZAkzA3PMrLqU/4WG5SS AH3hDoYIOuhlMqeVOSiLILvfSsjyq9lG47hhJFYAL3ITkqArjBnDm9aIuIb7n5k1rc+N vbZtoaOK8zXTbe/K6Rjo7gOZPeUFtV3NprK5j5asNWYgvNiShLNYWAC81w99bQ4hmpXH N1Auh7VUYQ2F4jai+XzrbJ2w4+JOkOMd1A2HaSY8Zm7GFEvh7AE635GL+sdXutUzlG1p 1g/A== X-Gm-Message-State: AOAM53043TOjV68OxlnPuwTIlbwpM77Rck1ZeEFwxYltw/W3fYfw0nCh /lZ8/IY9jlu2TSym5cb/cV7SPy2ogYVLs0LHJzDIN3chE8U= X-Google-Smtp-Source: ABdhPJwD6TawIk5l6i6fOvCM/9PFDnAzQBth5EguVezlYKjgsiy9lHa99B+7oRFjGjWQkUZJQmZLU4gxMEUaQ5G0slQ= X-Received: by 2002:aa7:c9d1:: with SMTP id i17mr9972013edt.46.1617287891894; Thu, 01 Apr 2021 07:38:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 1 Apr 2021 23:38:01 +0900 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000004bc27a05beea2eb7" Subject: Re: [PHP-DEV] [VOTE] Object scoped RNG implementation From: zeriyoshi@gmail.com (Go Kudo) --0000000000004bc27a05beea2eb7 Content-Type: text/plain; charset="UTF-8" Hi Xavier > If I understand correctly, this would > - provide us with performant object-encapsulated (isolated from global state) equivalents of the existing `mt_srand()`/`mt_rand()` and `random_int()` functions as well as a new "XorShift128+"; along with some global functions for usability, notably `rng_bytes()` and `rng_int()` respectively similar to `random_bytes()` and `random_int()` but with an additional (first) RNG argument > - enable us to use them (the objects), as well as other (extension or userland) implementations of the `RNG\RNGInterface`, for the existing `array_rand()`, `shuffle()` and `str_shuffle()` functions (instead of the default internal MT implementation) Yes, that's right. > I can't vote (yes), but I just suggest you complete the stubs in the RFC with what can been seen at < https://github.com/php/php-src/pull/6568/files?file-filters%5B%5D=.php#diff-d469bf38690924187e7b9db4a8ab199a99394b404bb12325a789141c56edb12f> and below, showing that the class `OS` has the minimal interface while classes `MT19937` and `XorShift128Plus` have a public `__construct(int $seed)` and implement the magic `__serialize()`/`__unserialize()`. I've added it to the RFC. Thank you! --0000000000004bc27a05beea2eb7--