Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:31106 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10552 invoked by uid 1010); 19 Jul 2007 17:26:40 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 10537 invoked from network); 19 Jul 2007 17:26:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jul 2007 17:26:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=david.coallier@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=david.coallier@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.184.239 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: david.coallier@gmail.com X-Host-Fingerprint: 64.233.184.239 wr-out-0506.google.com Linux 2.4/2.6 Received: from [64.233.184.239] ([64.233.184.239:17291] helo=wr-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/82-21764-DCE9F964 for ; Thu, 19 Jul 2007 13:26:39 -0400 Received: by wr-out-0506.google.com with SMTP id q50so525826wrq for ; Thu, 19 Jul 2007 10:26:35 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=Zd2G7l1aasO2TmKBVnb2zhqzwQjZPxfR/OMPWqR7NPp1NwrGgG+He9lA4fWPolcUSxvVoVuZr3fLVFj99Q06Kce6kkR0eH1gft9aAqV24pBz0tobTH6t4pdcw2l/GujANN5ZqNvRcUUXP5GuGQ6TCm3qE6xH/DYNDMaXLHFGF8E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=r/VuiDOrUGoQIuDiOQ7JpN9MEN4uxTLjlFdQwWXbBrLZLkmmAEwmAlKkcxr2uNNQJEIYbdM2F+EkoC92K5Dh/NMquPqP83Jr+B4BSJal7H2xjKcmzb4nhi2wf+yuWuJLiM6NSnQy/j/Vg5ciL+dDyWUOBcwJIUUFnJs8nTV+uNQ= Received: by 10.90.34.3 with SMTP id h3mr3145964agh.1184865994317; Thu, 19 Jul 2007 10:26:34 -0700 (PDT) Received: by 10.90.96.12 with HTTP; Thu, 19 Jul 2007 10:26:34 -0700 (PDT) Message-ID: Date: Thu, 19 Jul 2007 13:26:34 -0400 Sender: david.coallier@gmail.com To: "Antony Dovgal" Cc: "Keryx Web" , internals@lists.php.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <469E59FA.6060104@keryx.se> <0E62C134-68DF-4240-81BB-3A3EEA0E293D@prohost.org> <469F6A09.2050909@keryx.se> <469F6EE1.7080104@zend.com> X-Google-Sender-Auth: 63d960bb2ddca318 Subject: Re: [PHP-DEV] libc and random functions From: davidc@php.net ("David Coallier") On 7/19/07, David Coallier wrote: > On 7/19/07, Antony Dovgal wrote: > > On 19.07.2007 17:41, Keryx Web wrote: > > > Ilia Alshanetsky wrote: > > >> Do you have a patch? > > > > > > Also @Antony Dovgal in the "let blocks" thread > > > > > > Short answer: No. > > > > > > The reason I posted my suggestions on this list was that a while ago I > > > had a few ideas as to how PHP could be improved. > > > > What I don't understand about the crypt thing you propose - is what problem are you trying to fix this way? > > > > If there are no problems, then please don't improve anything not broken. > > "No reasons to keep it" is wrong, there is at least one reason to keep it as is - it works fine. > > Sorry I did not quite answer your question in my email + patch. Yes it works correctly as it is, however, with this patch, the random numbers being generated are using an algorithm (Mersenne Twister) that allows us to give more randomness if I may use the term. So it simply doesn't *fix* anything, but improves random number generation. There are various reasons why people are using random generated numbers and mt_ is more random than rand*. Simply it. It does not **fix** something that is broken, simply improves it. Yes we could still use a rock to make fire, and it still works fine, but might as well use matches, lenses or lighters. It's more effective and faster. > > -- > > Wbr, > > Antony Dovgal > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > Here are three patches against HEAD [1], 5_2 [2] and the pecl > repository [3] (Do not shout just yet, I'll explain). > > The idea of the patches are pretty simple, aliasing rand, srand, > getrandmax to mt_rand, mt_srand, and mt_getrandmax. The goal is simply > having a better number generation. Nothing fancier, or more different, > but simply it. It works great (compiling great against 5_2, HEAD) and > Crisitan Rodriguez also tried the compilation. > > After a bit of discussion with Jani, I came to realize that keeping > the wrapper macro for php_rand, php_srand is plain useless. Yes some > pecl extensions do rely on them (and for those who do, I also provided > a patch [3]). We both realized that there's not many extensions > relying on php_rand and php_srand thus removed it completely.. > > Here are the patches: > > [1] HEAD : http://dev.agoraproduction.com/php/php6/head-mt-changes.diff > [2] 5_2 : http://dev.agoraproduction.com/php/5_2/5.2-mt-changes.diff > [3] PECL : http://dev.agoraproduction.com/php/php6/pecl-mt-changes.diff > > > Please note that the mt-changes patches are not only changing > ext/standard/* but also the ext/* relying on them. (soap, mcrypt) but > also a small change in main/reentrancy.c both in 5_2 and HEAD. > > Thanks, > > -- > David Coallier, > Founder & Software Architect, > Agora Production (http://agoraproduction.com) > 51.42.06.70.18 > -- David Coallier, Founder & Software Architect, Agora Production (http://agoraproduction.com) 51.42.06.70.18