Hi All,
how do i generate random floats and random doubles in PHP?
Also does anyone know how I can get the time() function to return the number of milliseconds ellapsed since epoch?
Thanks,
Dipesh
I know I'm not allowed to say this on this site, but I'm doing it anyway: Check the manual before you post:
http://www.php.net/manual/en/function.rand.php http://www.php.net/manual/en/function.microtime.php
microtime() gives you the time in micro-seconds.
Why would someone do that? It's much easier to ask clueless questions than to actually read.
Please post some code to show me how to do this "reading".
I know its in the manual, but there's nothing about floats or doubles. You have to supply a range e.g. rand(0, 5) returns an int between 0 and 5. How do i do this for floats and doubles?
PHP doesn't have any strict types for vars, so if you want a float, just create an int and devide it by 10* the number of decimals you need.