On Wed, Dec 16, 2020 at 4:56 PM Sara Golemon <poll...@php.net> wrote:
> Welcome! I'm about to knock down your suggestion a little, but please
take it as constructive feedback.

OK, You're welcome. And sorry for replying directly to you by mistake.

> Can you clarify what object handling provides?  Is the intent to have an
expanded API for producing a reliably predictable series of numbers based
on more finely tunable seeds? Iterable PRNG generator?

Object scope PRNGs are useful when consistency of the result with respect
to the seed value is required
For example, the following code will result in unintended behavior if the
generated values are required to be consistent.

\mt_srand(1234);
foo();
\mt_rand() === 411284887; // false

function foo() {
    \mt_rand(); // code added
}

They also have the added benefit of being serializable. Being able to
serialize the state allows us to take advantage of the PRNG's random
periods.

> We've had that since 7.0:

I'm talking about the call to the php_combined_lcg() function inside PHP.
This is still in use today for various purposes such as Meresenne Twister
initial seeding, sessions, etc.

> Bundling extensions usually comes when an extension has shown widespread
popularity/use.  With all due respect, this repo is less than two weeks old
and has 8 stars. Who needs this and why is it not services by the PRNG and
CSPRNG options already available?

I am not planning to bundle this implementation into the core, and I think
that would require a deeper discussion in the RFC.
I plan to implement it in full scratch according to the results.

Reply via email to