How good is Rand() in PHP?Not Good:I needed an image of random noise (to demonstrate that it had a [http://en.wikipedia.org/wiki/Box-counting_dimension](box-counting dimension) of 3). So I wrote the following script to throw one together, but it doesn't look random enough.
Up close:If we zoom in by a factor of five it looks even worse.
It'll be ok
A simple change to "mt_rand()" from "rand()" and the picture looks much much better. The filesize also jumps from 33k to 167k, which means that the PNG algorithm isn't able to compress the picture near as well. DetailsThis is PHP 4.4.2 on Windows. |
What I've said lately Loading feeds
More of me on the web
|