Re: mt_rand() - the same forever?
| From: | Stut | Date: | Mon, 06 Oct 2008 10:07:00 +0000 |
| Subject: | Re: mt_rand() - the same forever? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281467@lists.php.net to get a copy of this message | ||
On 6 Oct 2008, at 10:58, Nathan Rixham wrote:
Janek wrote:On the contrary... find the implementation for that function in the PHP source code and check the complete CVS history to see if its ever changed. That's the only way you'll know for sure. Personally I wouldn't bother. It will be easier and safer to find the code, port it to PHP and use that instead. That way it's your code, you control it and you can *know* it's not going to change regardless of PHP version. -Stut -- http://stut.net/On Sun, Oct 5, 2008 at 10:05 PM, Ashley Sheridan <ash@ashleysheridan.co.uk> wrote:why not give us your code and expected results, a few of us can run it on our various php installs and post back the results. No other way to find out for sure!On Sun, 2008-10-05 at 21:57 +0200, Janek wrote:No. When I give a fixed seed to mt_srand(), each time I get the same sequence of mt_rand()s. My question is wheather the actual algorithm behind these functions is likely to change in the next version of PHP or not. JanekI know, but I *want* to seed it. My goal is to have a fixed pseudorandom sequence for each integer (seed) and I don't want those sequences to change regarding PHP version. Janek On Sun, Oct 5, 2008 at 9:52 PM, Richard Heyes <richard@php.net> wrote:Doesn't it also rely on the system clock as well? Ash www.ashleysheridan.co.ukI wonder whether I can rely on the stability of mt_srand() and mt_rand(). I want them to generate the same sequence for a fixed seed, regardless of PHP version. Do you think I can trust it? JanekKeep in mind (if you're not already) that mt_rand() doesn't technically need to be seeded. -- Richard Heyes HTML5 Graphing for FF, Chrome, Opera and Safari: http://www.phpguru.org/RGraph