Hi all,
On Wed, Feb 1, 2017 at 5:48 AM, Andrea Faulds wrote:
> 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.
>
>
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
On 30.01.2017 at 17:29, Andrea Faulds wrote:
> Christoph M. Becker wrote:
>
>> Just a quick idea:
>>
>> >
>> class PNRG {
>> public function __construct($seed = null) {…}
>> public function get() {…}
>> }
>
> I've long favoured an API along these lines. One size does not fit all,
> you n
Hi Andrea,
On Tue, Jan 31, 2017 at 1:29 AM, Andrea Faulds wrote:
>
> Christoph M. Becker wrote:
>
> Just a quick idea:
>>
>> >
>> class PNRG {
>> public function __construct($seed = null) {…}
>> public function get() {…}
>> }
>>
>>
> I've long favoured an API along these lines. One size
Hi Christoph,
On Mon, Jan 30, 2017 at 10:20 PM, Christoph M. Becker
wrote:
> Just a quick idea:
>
>
> class PNRG {
> public function __construct($seed = null) {…}
> public function get() {…}
> }
>
Object based implementation is a lot cleaner. I'm willing to write one
but not now... I w
Hi Christoph,
Christoph M. Becker wrote:
Just a quick idea:
I've long favoured an API along these lines. One size does not fit all,
you need two APIs for (non-crytographic) random numbers:
- automatically-seeded, non-reproducible numbers (a global function like
rand())
- manually-seeded,
On 30.01.2017 at 13:32, Yasuo Ohgaki wrote:
> Hi all,
>
> Following code is problematic and needs proper reseeding to work.
>
> // We need the same random numbers here
> mt_srand(1234);
> for ($i=0; $i < 10; $i++) {
>$my_rand[] = mt_rand();
> }
>
> Somewhere later in code
>
> // We need so