Rand - continue or not?
| From: | jeroen@php.net | Date: | Thu, 20 Sep 2001 20:50:42 +0000 |
| Subject: | Rand - continue or not? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-66258@lists.php.net to get a copy of this message | ||
By special request:
These are the pro's and contra's to the current proposal currently known
with me.
(see: http://www.A-Eskwadraat.nl/~jeroen/rand/ )
###Pro's:
* Hide seeding and such from the php-programmer
* All randomness controllable, with clear syntax.
* The choice-for-algorithm should NOT be to the php-programmer if you're
after random numbers.
* Make it _possible_ to add a real-random-number generator which will be
used by PHP
* Namespace-cleaning: rand, srand, getrandmax, mt_rand, mt_srand,
mt_getrandmax and lcg_value not needed anymore, simply 'random',
'random_set', and possibly 'random_value' for getting a [0,1) float.
###Contra's:
* "Slower": [My code was less than 1% slower, so it's neglectable]
* More complicated C-code [True]
* Leaks, bad coding style, etc: [Implementation isn't discussed here]
* Don't fix if it isn't broken [This is no fix, it's better syntax]
Based on these arguments, I don't see any reason why not to go on. If anyone
does see a reason, and/or I missed an argument, please mail it to php-dev
and/or myself.
TIA,
Jeroen
PS: The proposal is slightly updated because of a suggestion by someone
(Joey IIRC)