Re: [PHP] mt_rand() - the same forever?
On Mon, Oct 6, 2008 at 1:53 PM, Eric Butera [EMAIL PROTECTED] wrote: On Sun, Oct 5, 2008 at 2:25 PM, Janek [EMAIL PROTECTED] wrote: I 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? Janek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php A while ago I saw on internals where someone was talking about why their random numbers weren't giving the same response using the same seed anymore after upgrading. The dev's said a random number is a random number and should never be relied upon to give the same result, ever. That may have been a different function, but I'm sure that mindset would persist across all random functions. Thanks, that settles it. I think I will use the second idea from Jochem or something like that. Janek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mt_rand() - the same forever?
I 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? Janek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mt_rand() - the same forever?
I 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 [EMAIL PROTECTED] wrote: I 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? Janek Keep 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mt_rand() - the same forever?
On Sun, Oct 5, 2008 at 10:05 PM, Ashley Sheridan [EMAIL PROTECTED] wrote: On Sun, 2008-10-05 at 21:57 +0200, Janek wrote: I 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 [EMAIL PROTECTED] wrote: I 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? Janek Keep 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 Doesn't it also rely on the system clock as well? Ash www.ashleysheridan.co.uk 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. Janek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php