Re: RFC: mt_* functions

From: Date: Sat, 04 Aug 2001 22:46:57 +0000
Subject: Re: RFC: mt_* functions
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-62102@lists.php.net to get a copy of this message
> Both function families are the same in syntax & returning, only the > algorithm is different. I.e.: the semantics is the same. The algorithm - if > correct - shouldn't bother, and shouldn't be the concern of the programmer, > but rather the system maintainer (specific cases excluded, but than you > leave the high-level of PHP, and go to low-level implementation issues.). But they are different in that each will produce a deterministic sequence based on their seeds. If I, as an application developer, distributes a regression test harness which tests my app with a specific seed expecting a specific sequence and the server my app runs on has switched rand() to use the mt_rand() algorithm my regression test will fail. This is somewhat like saying that we should make crypt() just be an alias for md5() since md5() is a better algorithm. The fact that it is better is rather irrelevant since the output of the algorithm itself is sometimes important. Many times you can swap crypt() for md5(), but many times you can't. Same goes for rand() and mt_rand(). -Rasmus

« previous php.dev (#62102) next »