Re: Really random ?
| From: | Pierre Joye | Date: | Wed, 04 Mar 2009 14:30:40 +0000 |
| Subject: | Re: Really random ? | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-43249@lists.php.net to get a copy of this message | ||
hi,
On Wed, Mar 4, 2009 at 2:50 PM, Kenan Sulayman <kureal@kkooporation.de> 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