Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43249 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15523 invoked from network); 4 Mar 2009 14:30:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Mar 2009 14:30:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.159 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 72.14.220.159 fg-out-1718.google.com Received: from [72.14.220.159] ([72.14.220.159:46210] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E5/95-22733-4909EA94 for ; Wed, 04 Mar 2009 09:30:45 -0500 Received: by fg-out-1718.google.com with SMTP id e12so196746fga.23 for ; Wed, 04 Mar 2009 06:30:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=tiNBylULsfto1ur2jHvuKQwk3RDDj20hATnxBPvWHlE=; b=ipREokIdQWJU+eIoGRDjyOpL+6i6IGmUA7XWWnUj9/DudYLsJQsx7xcdxxLSMDv5Zt 4ciSGHi6t2h7S2OX1EUUQEZ+hhLy3apawLA1bSzW1X+RGOBW4sKHBHEJosNxDD1HB6M4 kLuiTOBk0U7U3tQlm/tuHdbhCiWM4mWM0z6XU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=o5gHggXGjvU1arzAjVqNADWI7xJkwzYXj9rGT2tYeQG0G0gCNNxhYXnHhujeL2MbiZ nZ2LpN/KkVs/fa6RPRDz57hVls3SOx0RfJyKpCOgcs1NO4+qgeOjYj6tGyLLOgUAGVb3 CypCF7iPbzL7YXg1RrW1+JPp+3ejqN8OwWZxI= MIME-Version: 1.0 Received: by 10.86.53.8 with SMTP id b8mr114713fga.58.1236177041014; Wed, 04 Mar 2009 06:30:41 -0800 (PST) In-Reply-To: References: Date: Wed, 4 Mar 2009 15:30:40 +0100 Message-ID: To: Kenan Sulayman Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Really random ? From: pierre.php@gmail.com (Pierre Joye) hi, On Wed, Mar 4, 2009 at 2:50 PM, Kenan Sulayman wrote: > I've been running several million tests regarding the > arithmetically-random-functions. > > The returning value at the end: > Avg: mt_r: 1073848211.4106 r: 16384.155746685 ~8016909 > Avg: mt_r: 1073904131.0286 r: 16384.164383921 ~8503575 > Avg: mt_r: 1074010520.4456 r: 16384.091213092 ~13136327 > > Shape: > Avg: mt_r: { avg of mt_rand() } r: { avg of rand() } ~ { value of $i ( > iterations ) } > > Means: > Average of mersenne twister in 8016909 it's is 1073848211.4106 ( > corresponding to that in 8503575 it's the avg. is 1073904131.0286). > That's acceptable. > > The rand(x) function alters the avg in 5M iterations really by just 0.1 ? > Wow, that's creepy. > > Is there any way - to make it better ( or a bit as good as the m_twister is > ? ) ? Use http://us.php.net/mtrand Still some issues but already better. Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org