Hi,

Yasuo Ohgaki wrote:
My current objective is to make existing API to work, so resource may be
used
to set/get PRNG state.

I would prefer it if we not introduce a new usage of resources. An object would suffice.

*** Initialize and Create new PRNG state resource ***
resource mt_srand([int|string $seed])

resource: MT rand state resource.
$seed: I would like to allow large seed like Python and Ruby.
            When seed is string, use all bits for MT rand state
initialization.
            Example usage: mt_srand(random_bytes(2000));

*** Get random number from state resource ***
int mt_rand() // System state
int mt_rand(resource $state) // Specified user state
int mt_rand(int $min , int $max [,resource $state]) // Specified user state
if $state is passed

While we could retrofit this into the existing API, it would be cleaner and friendlier to provide a new one based on objects.


--
Andrea Faulds
https://ajf.me/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to