Re: random_seed()
| From: | Benjamin Morel | Date: | Mon, 01 Apr 2019 08:07:47 +0000 |
| Subject: | Re: random_seed() | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-105024@lists.php.net to get a copy of this message | ||
Seeds could even be dangerous here, as these numbers are supposed to be
cryptographically secure. If you need a seedable PRNG for testing, just use
rand().
Ben
On Mon, 1 Apr 2019 at 09:57, Pierre Joye <pierre.php@gmail.com> wrote:
> Good afternoon,
>
> fully correct. Seeds are not needed anymore.
>
>
> best,
>
> On Mon, Apr 1, 2019, 12:44 PM Arvids Godjuks <arvids.godjuks@gmail.com>
> wrote:
>
> > On Mon, Apr 1, 2019, 05:52 David Rodrigues <david.proweb@gmail.com>
> wrote:
> >
> > > Just to know, can we have a random_seed() for
> random_int()/random_bytes()
> > > like we have mt_srand() to mt_rand()?
> > >
> > > I don't know if random_int() is more "random" than mt_rand(), but if
> > > it
> > is,
> > > so maybe is valid a random_seed() function.
> > >
> > > --
> > > David Rodrigues
> > >
> >
> > Hello,
> >
> > random_bytes/random_int use proper random generation source -
> /dev/urandom
> > in most cases (and appropriate source on windows) - that's the whole
> point
> > why they were introduced. There is no need for seeds nor it can even be
> > initialized with a seed.
> > They are, as far as I understand, cryptographically safe random
> generators.
> >
> > I suggest reading up on the subject, the RFC and the whole thing. Their
> > introduction was well covered by various core devs in blog posts.
> >
> > >
> >
>