[thelist] srand in php

Andrew Forsberg andrew at thepander.co.nz
Tue Oct 23 17:02:28 CDT 2001


>The maximum random number my environment can generate (with mt_ or 
>standard random number generation) is 2147483647. Perhaps yours is 
>lower, which would explain why you aren't getting anything with a 
>leftmost digit of 2.

Doh!

That'd be because that's the maximum int size on my platform:

>The size of an integer is platform-dependent, although a maximum 
>value of about two billion is the usual value (that's 32 bits 
>signed). PHP does not support unsigned integers.

Yours is obviously smaller. Multiplying the five digit number by 
100,000 should, according to the docs, force the number to become a 
float.

You will need to use a float if you really need such a larger number, 
although that may well cause other problems. Why do you need such a 
large key?

Cheers
Andrew

-- 
Andrew Forsberg
---
uberNET - http://uber.net.nz/
the pander - http://thepander.co.nz/




More information about the thelist mailing list