What is a random seed?

Asked

Viewed 592 times

3

I asked a question here about a question I had about how we used random number generation.

What is Mersenne Twister?

There I quote that PHP uses a term called "sow random numbers" or "random seed".

This is a reference to functions mt_srand and srand which, according to the PHP Handbook, predates versions 4.1 it was mandatory to use these functions before invoking functions that generated random numbers (mt_rand and rand).

And I have the impression of having already seen these functions "sowers" in C.

What is a random seed?

Why, prior to these versions, it was necessary to call a sower, and now it is no longer?

  • Well, I was wondering why these functions are no longer called to use the "random" ones as well.

1 answer

3


Quick response: because they changed the algorithm for the Mersenne Twister.


A random seed is any number or vector used to initialize a pseudo-random number generator which, in turn, is a deterministic algorithm for generating numbers whose sequences are roughly those expected of numbers (really, emphasize) random. The importance of generating good random numbers has to do with its many applications, from cryptography to computer simulation.

In PHP versions 4 and 5 there is a function (mt_rnd) to replace the use of the pseudo-random number generator of libc old with rand because previous algorithms were slower and were suspected to have undesirable characteristics for calculating good random numbers. The new version actually uses the Mersenne Twister which is the most common algorithm in the world to generate this type of numbers (at least as regards the most common applications).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.