On Thu, Apr 1, 2021 at 6:39 AM Go Kudo <zeriyo...@gmail.com> wrote:

> Hello everyone.
>
> Object scoped RNG RFC vote is now open.
> https://wiki.php.net/rfc/object_scope_prng
>
> The deadline for voting is April 15.
>
> Previous discussions can be viewed below.
>
> https://externals.io/message/112765
> https://externals.io/message/112819
> https://externals.io/message/113720
>
> Regards,
> Go Kudo
>

Hello,

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)
?

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()`.

Best regards,

-- 
Guilliam Xavier

Reply via email to